App::Chart::Memoize::ConstSecond -- memoize functions to cache for 1 second
sub foo { some_code() }; use App::Chart::Memoize::ConstSecond 'foo'; sub bar { some_code() }; # or a set of functions at once sub quux { some_code() }; use App::Chart::Memoize::ConstSecond 'bar','quux'; use App::Chart::Memoize::ConstSecond 'Some::Other::func';
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.
App::Chart::Memoize::ConstSecond
time()
There are no functions as such, everything is accomplished through the use import.
use
use App::Chart::Memoize::ConstSecond 'func'
use App::Chart::Memoize::ConstSecond 'Some::Package::func'
Memoize::Expire adds a similar time-based expiry to the Memoize cache. ConstSecond is a lot smaller.
Memoize::Expire
Memoize
ConstSecond
To install App::Chart, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Chart
CPAN shell
perl -MCPAN -e shell install App::Chart
For more information on module installation, please visit the detailed CPAN module installation guide.