# MemCached store: Works like DRbStore, but uses Danga's MemCache instead.
4) MemCached store: Works like DRbStore, but uses Danga's MemCache instead.
Rails uses the bundled memcached-client gem by default. This is currently the
most popular cache store for production websites.
Special features:
* Clustering and load balancing. One can specify multiple memcached servers,
* Clustering and load balancing. One can specify multiple memcached servers,
and MemCacheStore will load balance between all available servers. If a
server goes down, then MemCacheStore will ignore it until it goes back
online.
* Time-based expiry support. See +write+ and the +:expires_in+ option.
* Per-request in memory cache for all communication with the MemCache server(s).
* Time-based expiry support. See +write+ and the +:expires_in+ option.
* Per-request in memory cache for all communication with the MemCache server(s).
It also accepts a hash of additional options:
* +:namespace+- specifies a string that will automatically be prepended to keys when accessing the memcached store.
* +:readonly+- a boolean value that when set to true will make the store read-only, with an error raised on any attempt to write.
* +:multithread+ - a boolean value that adds thread safety to read/write operations - it is unlikely you'll need to use this option as the Rails threadsafe! method offers the same functionality.
* +:namespace+- specifies a string that will automatically be prepended to keys when accessing the memcached store.
* +:readonly+- a boolean value that when set to true will make the store read-only, with an error raised on any attempt to write.
* +:multithread+ - a boolean value that adds thread safety to read/write operations - it is unlikely you'll need to use this option as the Rails threadsafe! method offers the same functionality.
The read and write methods of the MemCacheStore accept an options hash too.
When reading you can specify +:raw => true+ to prevent the object being marshaled
...
...
@@ -391,14 +396,14 @@ for the cached item in seconds.