Class: SdbDal::MemoryStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/sdb_dal/memory_storage.rb

Instance Method Summary collapse

Constructor Details

#initializeMemoryStorage

Returns a new instance of MemoryStorage.



6
7
8
9
# File 'lib/sdb_dal/memory_storage.rb', line 6

def initialize
  @stuff={}
  @attributes={}
end

Instance Method Details

#delete(bucket, key) ⇒ Object



14
15
16
17
18
# File 'lib/sdb_dal/memory_storage.rb', line 14

def delete(bucket,key)
  @attributes.delete(bucket+"sdsdw555"+key)
  return @stuff.delete(bucket+"sdsdw555"+key)
      
end

#get(bucket, key) ⇒ Object



10
11
12
13
# File 'lib/sdb_dal/memory_storage.rb', line 10

def get(bucket,key)
  return @stuff[bucket+"sdsdw555"+key]
      
end

#get_content_type(bucket, key) ⇒ Object



23
24
25
26
# File 'lib/sdb_dal/memory_storage.rb', line 23

def get_content_type(bucket,key)
  return @attributes[bucket+"sdsdw555"+key]['Content-Type'] if @attributes.has_key?(bucket+"sdsdw555"+key)
  return nil
end

#put(bucket, key, object, attributes = nil) ⇒ Object



19
20
21
22
# File 'lib/sdb_dal/memory_storage.rb', line 19

def put(bucket,key,object,attributes=nil)
  @stuff[bucket+"sdsdw555"+key]=object
  @attributes[bucket+"sdsdw555"+key]=attributes if attributes    
end