Class: SdbDal::MemcacheRepository
- Inherits:
-
Object
- Object
- SdbDal::MemcacheRepository
- Defined in:
- lib/sdb_dal/memcache_repository.rb
Instance Attribute Summary collapse
-
#storage ⇒ Object
Returns the value of attribute storage.
-
#use_cache ⇒ Object
this here just so interface matches sdb repo.
Instance Method Summary collapse
- #clear ⇒ Object
- #clear_session_cache ⇒ Object
- #destroy(table_name, primary_key) ⇒ Object
-
#find_one(table_name, primary_key, attribute_descriptions) ⇒ Object
, non_clob_attribute_names, clob_attribute_names).
- #get_clob(table_name, primary_key, clob_name) ⇒ Object
-
#initialize(sdb_domain = nil, clob_bucket = nil, aws_key_id = nil, aws_secret_key = nil, memcache_servers = nil, a_storage = nil, append_table_to_domain = nil, options = {}) ⇒ MemcacheRepository
constructor
A new instance of MemcacheRepository.
- #pause ⇒ Object
- #query(table_name, attribute_descriptions, options) ⇒ Object
- #query_ids(table_name, attribute_descriptions, options) ⇒ Object
- #save(table_name, primary_key, attributes, index_descriptions) ⇒ Object
Constructor Details
#initialize(sdb_domain = nil, clob_bucket = nil, aws_key_id = nil, aws_secret_key = nil, memcache_servers = nil, a_storage = nil, append_table_to_domain = nil, options = {}) ⇒ MemcacheRepository
Returns a new instance of MemcacheRepository.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sdb_dal/memcache_repository.rb', line 8 def initialize( sdb_domain= nil, clob_bucket= nil, aws_key_id= nil, aws_secret_key= nil, memcache_servers = nil , a_storage=nil, append_table_to_domain=nil, ={} ) [:memory_only] ||=(aws_key_id==nil) @storage||=Storage.new(aws_key_id,aws_secret_key,memcache_servers,[],) @sdb_domain=sdb_domain @clob_bucket=clob_bucket end |
Instance Attribute Details
#storage ⇒ Object
Returns the value of attribute storage.
7 8 9 |
# File 'lib/sdb_dal/memcache_repository.rb', line 7 def storage @storage end |
#use_cache ⇒ Object
this here just so interface matches sdb repo
6 7 8 |
# File 'lib/sdb_dal/memcache_repository.rb', line 6 def use_cache @use_cache end |
Instance Method Details
#clear ⇒ Object
31 32 33 |
# File 'lib/sdb_dal/memcache_repository.rb', line 31 def clear end |
#clear_session_cache ⇒ Object
27 28 29 |
# File 'lib/sdb_dal/memcache_repository.rb', line 27 def clear_session_cache end |
#destroy(table_name, primary_key) ⇒ Object
66 67 68 69 70 |
# File 'lib/sdb_dal/memcache_repository.rb', line 66 def destroy(table_name, primary_key) key=make_cache_key(table_name,primary_key); @storage.put(@clob_bucket,key,nil) end |
#find_one(table_name, primary_key, attribute_descriptions) ⇒ Object
, non_clob_attribute_names, clob_attribute_names)
55 56 57 58 59 60 61 |
# File 'lib/sdb_dal/memcache_repository.rb', line 55 def find_one(table_name, primary_key,attribute_descriptions)#, non_clob_attribute_names, clob_attribute_names) key=make_cache_key(table_name,primary_key) @storage.get(@clob_bucket,key) end |
#get_clob(table_name, primary_key, clob_name) ⇒ Object
62 63 64 65 |
# File 'lib/sdb_dal/memcache_repository.rb', line 62 def get_clob(table_name,primary_key,clob_name) raise " not supported for memcache repo" end |
#pause ⇒ Object
24 25 |
# File 'lib/sdb_dal/memcache_repository.rb', line 24 def pause end |
#query(table_name, attribute_descriptions, options) ⇒ Object
52 53 54 |
# File 'lib/sdb_dal/memcache_repository.rb', line 52 def query(table_name,attribute_descriptions,) raise " not supported for memcache repo" end |
#query_ids(table_name, attribute_descriptions, options) ⇒ Object
47 48 49 50 |
# File 'lib/sdb_dal/memcache_repository.rb', line 47 def query_ids(table_name,attribute_descriptions,) raise " not supported for memcache repo" end |
#save(table_name, primary_key, attributes, index_descriptions) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sdb_dal/memcache_repository.rb', line 35 def save(table_name, primary_key, attributes,index_descriptions) key=make_cache_key(table_name,primary_key); record={} attributes.each do |description,value| record[description.name]=value end record["metadata%table_name"]=table_name record["metadata%primary_key"]=key @storage.put(@clob_bucket,key,record) end |