The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FP::Memoizing - a functional memoize

SYNOPSIS

    use FP::Memoizing qw(memoizing memoizing_to_dir);
    use Chj::tempdir;
    my $tmp= do{ mkdir ".tmp"; tempdir ".tmp/" };

    my $count=0;
    sub f { $count++; $_[0] * 5 }

    *fm= memoizing *f; # memoize in process memory
    *fm2= memoizing_to_dir $tmp, *f; # memoize to files in ".foo/"

    is fm(3), 15;
    is $count, 1;
    is fm(3), 15;
    is $count, 1;
    is fm(2), 10;
    is $count, 2;
    is fm2(3), 15;
    is $count, 3;
    is fm2(3), 15;
    is $count, 3;

DESCRIPTION

TODO

No locking whatsoever is currently being done.

Also, serializes twice in different ways, for the key and the actual storage. Could Storable be used for the key as well?

NOTE

This is alpha software! Read the status section in the package README or on the website.