Class Merb::Cache::MemoryStore
In: lib/merb-cache/cache-store/memory.rb
Parent: Object

Methods

Public Class methods

Provides the memory cache store for merb-cache

Public Instance methods

Capture or restore the data in cache. If the cache entry expired or does not exist, the data are taken from the execution of the block, marshalled and stored in cache. Otherwise, the data are loaded from the cache and returned unmarshalled

Parameters

_controller<Merb::Controller>:The instance of the current controller
key<String>:The key identifying the cache entry
from_now<~minutes>:The number of minutes (from now) the cache should persist
&block:The template to be used or not

Additional information

When fetching data (the cache entry exists and has not expired) The data are loaded from the cache and returned unmarshalled. Otherwise: The controller is used to capture the rendered template (from the block). It uses the capture_#{engine} and concat_#{engine} methods to do so. The captured data are then marshalled and stored.

Fetch data from the file using the specified key The entry is deleted if it has expired

Parameter

key<Sting>:The key identifying the cache entry

Returns

data<String, NilClass>:nil is returned whether the entry expired or was not found

Store data to the file using the specified key

Parameters

key<Sting>:The key identifying the cache entry
data<String>:The data to be put in cache
from_now<~minutes>:The number of minutes (from now) the cache should persist

Gives info on the current cache store

Returns

  The type of the current cache store

Checks whether a cache entry exists

Parameter

key<String>:The key identifying the cache entry

Returns

true if the cache entry exists, false otherwise

Expire the cache entry identified by the given key

Parameter

key<Sting>:The key identifying the cache entry

Expire all the cache entries

Expire the cache entries matching the given key

Parameter

key<Sting>:The key matching the cache entries

This method is there to ensure minimal requirements are met (directories are accessible, table exists, connected to server, …)

[Validate]