NAME
App::Chart::Memoize::ConstSecond -- memoize functions to cache for 1 second
SYNOPSIS
sub
foo { some_code() };
sub
bar { some_code() };
# or a set of functions at once
sub
quux { some_code() };
DESCRIPTION
App::Chart::Memoize::ConstSecond
modifies given functions so that the return value from the original is cached for 1 second (until time()
ticks over). This is meant to save work if the original func has to do something slow like a disk lookup or similar, yet still re-run that later on to allow for changes.
FUNCTIONS
There are no functions as such, everything is accomplished through the use
import.
use App::Chart::Memoize::ConstSecond 'func'
use App::Chart::Memoize::ConstSecond 'Some::Package::func'
OTHER NOTES
Memoize::Expire
adds a similar time-based expiry to the Memoize
cache. ConstSecond
is a lot smaller.