Samizdat: Co-op Engine

Home | About | Documentation | Developers | Download

SynCache 1.2 (2011-12-25)

SynCache 1.2 introduces new RemoteCache wrapper class, uses Mutex semaphores directly instead of monkey-patching the obsolete and buggy sync.rb, and fixes several bugs in concurrency management and the syncache-drb daemon.



For the DRb based access to a remote SynCache process to work properly, all your fetch_or_add blocks should be thread-safe, because DRb will run them in their own threads. Also, if a Ruby process crashes is the middle of such block, the key will remain locked in the remote cache until its ttl runs out. To work around these limitations, you can wrap access to a remote cache using a SynCache::RemoteCache object:
  require 'syncache'

  # connect to the remote cache
  @cache ='druby://localhost:9000')