cachetastic_adapters_base.rb

Path: lib/adapters/cachetastic_adapters_base.rb
Last Update: Tue Jun 03 13:14:49 -0400 2008

This class is the interface used to develop adapters for stores. Stores are where the data is actually held. These could be local memory, memcached, a database, the file system, etc… If you implement this API, then you should be able to plug in different stores for your caches without having to change any of your code.

Methods that need to be implemented:

  • setup - used to setup the implementation of the adapter.
  • set(key, object, expiry) - sets an object into the store using the given key and the expiry time.
  • get(key) - returns an object from the store for a given key.
  • delete(key, delay) - deletes an object from the store for a given key. If the store supports it, a delay can be used.
  • expire_all - expires all objects in the store for a given cache.
  • stats - returns statistics for the store.
  • valid? - used to test whether or not the store is still valid. If this returns false a new instance of the adapter is created by Cachetastic::Connection

[Validate]