Memory Cache Store

A cache store implementation which stores everything into memory in the same process. If you’re running multiple Ruby on Rails server processes (which is the case if you’re using Phusion Passenger or puma clustered mode), then this means that Rails server process instances won’t be able to share cache data with each other and this may not be the most appropriate cache in that scenario.

This cache has a bounded size specified by the :size options to the initializer (default is 32Mb). When the cache exceeds the allotted size, a cleanup will occur which tries to prune the cache down to three quarters of the maximum size by removing the least recently used entries.

Unlike other Cache store implementations, MemoryStore does not compress values by default. MemoryStore does not benefit from compression as much as other Store implementations, as it does not send data over a network. However, when compression is enabled, it still pays the full cost of compression in terms of cpu use.

MemoryStore is thread-safe.

Constants

PER_ENTRY_OVERHEAD = 240

Attributes

Show files where this class is defined (1 file)
Register or log in to add new notes.