Class: Merb::Cache::MemcachedStore

Class | Merb::Cache::MemcachedStore
In: | lib/merb-cache/stores/fundamental/memcached_store.rb
Parent: | AbstractStore

Memcached store uses one or several Memcached servers for caching. It‘s flexible and can be used for fragment caching, action caching, page caching or object caching.

### Methods

clone connect delete delete_all exists? expire_time fetch new normalize read writable? write

### Attributes

memcached | [RW] |
namespace | [RW] |
servers | [RW] |

### Public Class methods

new(config = {})

### Public Instance methods

clone()
connect(config = {})

Establishes connection to Memcached.

Use :buffer_requests option to use bufferring, :no_block to use non-blocking async I/O.

delete(key, parameters = {})

Deletes entry from cached by key.

delete_all()

Flushes the cache.

exists?(key, parameters = {})

returns true/false/nil based on if data identified by the key & parameters is persisted in the store.

With Memcached 1.2 protocol the only way to find if key exists in the cache is to read it. It is very fast and shouldn‘t be a concern.

expire_time(conditions = {})

Returns expiration timestamp if :expire_in key is given.

fetch(key, parameters = {}, conditions = {}, &blk)

Fetches cached data by key if it exists. If it does not, uses passed block to get new cached value and writes it using given key.

normalize(key, parameters = {})

Returns cache key calculated from base key and SHA2 hex from parameters.

read(key, parameters = {})

Reads key from the cache.

writable?(key, parameters = {}, conditions = {})

Memcached store consideres all keys and parameters writable.

write(key, data = nil, parameters = {}, conditions = {})

Writes data to the cache using key, parameters and conditions.

[Validate]