public
Description: Tracks the keys added to an instance of MemCache
Clone URL: git://github.com/jamescook/memcache_keys_script.git
Search Repo:
README
-- This ruby script add a 'keys' method to inspect the key names for an instance of MemCache.
-- Internally, a separate KEYS hash is created to store the key names
-- In addition, the script uses the 'keys' method to serialize/deserialize data. AWESOME!!!

Example usage:
 --> CACHE = MemCache.new
 --> CACHE.servers = 'localhost:1337'
 
 --> CACHE.set('test', 'ABCDEF')
 =#> nil
 
 --> CACHE.keys
 =#> [:test]
 
 --> CACHE.delete('test')
 =#> "DELETED\r\n"
 
 --> CACHE.keys
 =#> []
 
-- Oh you want to save your objects to disk?

 --> cache = CACHE.serialize
 =#> "\004\b{\v:\ntest6o:\rMemCache\f:\021@multithreadF:\r@servers[\000:\016@readonlyF:\022@servers_hash
[\006\"\023localhost:1337:\r@buckets[\000:\017@namespace0:\023@alt_namespace\"\021keys_3015770:\ttest@\006:\ntest1@\006\
"
\022server_string@\b:\ntest2@\006:\ntest5@\006"
  
-- Pretend we wrote that to a file ..  

 --> NEWCACHE = MemCache.load_instance(File.read('my_cached_data'))
 =#> <MemCache: 1 servers, 1 buckets, ns: nil, ro: false>
 --> NEWCACHE.keys
 =#> [:test]
 
 
 
 
-- TODO: Handle all the attributes when serializing ..