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.
4) +ActiveSupport::Cache::MemCacheStore+: Works like +DRbStore+,
but uses Danga's +memcached+ 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, and MemCacheStore will load balance between all available servers. If a server goes down, then MemCacheStore will ignore it until it goes back online.
* 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).
* Per-request in memory cache for all communication with the +memcached+ 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.
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
(by default this is false which means the raw value in the cache is passed to
+Marshal.load+ before being returned to you.)
...
...
@@ -389,31 +391,29 @@ for the cached item in seconds.