ephemeral-cache
Cache that expires entries with timeout
Usage
Instantiate with default 30s timeout
var cache =
Change timeout to 30 minutes
cachetimeout = 30 * 60 * 1000
Main Operations
var value0 = cache // returns undefined for non-existent keys cache var value1 = cache // returns 'value' var value2 = cache // returns 'value' if deleted key exists var value3 = cache // returns undefined for deleted keys var size = cachesize
Reset to clean state; delete everything
cache
Notes
Timeout does not restart on get operation. Explicitly put again if needed.
cache var value = cache cache // restart timer