Prison
Simple interface for caching asynchronous callback responses.
Basic Usage
Creating a new Prison
var Prison = ;var prison = 90000;
Where 90000 is the time in milliseconds (which is 15 minutes) for the cache to live.
Cache on a key
var warden = prison;
If the cache is stale the result of callToDatabase
will be set as the new
value.
Setting the TTL on a per key basis
var warden = prison;
The time to live for this cached value will be 30 minutes.
Busting the cache
prison;
This sendsnull to the backend for 'some_key'.
Cache Backends
By default Prison uses an in memory store, but is highly extensible.
Passing a custom backend
var prison = 900000 custom_backend;
Custom backend is any object that implements
{ // returns value by key}
and
{ // sets value for key}