Kevin Ryde > chart > App::Chart::Memoize::ConstSecond

Download:
chart-248.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  15
Open  3
View/Report Bugs
Source  

NAME ^

App::Chart::Memoize::ConstSecond -- memoize functions to cache for 1 second

SYNOPSIS ^

 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';

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.

SEE ALSO ^

Memoize::Expire

syntax highlighting: