1Memoize::ExpireLRU(3) User Contributed Perl DocumentationMemoize::ExpireLRU(3)
2
3
4

NAME

6       Memoize::ExpireLRU - Expiry plug-in for Memoize that adds LRU cache
7       expiration
8

SYNOPSIS

10           use Memoize;
11
12           memoize('slow_function',
13                   TIE => [Memoize::ExpireLRU,
14                           CACHESIZE => n,
15                          ]);
16
17       Note that one need not "use" this module.  It will be found by the
18       Memoize module.
19
20       The argument to "CACHESIZE" must be an integer.  Normally, this is all
21       that is needed.  Additional options are available:
22
23               TUNECACHESIZE => m,
24               INSTANCE      => 'descriptive_name',
25               TIE           => '[DB_File, $filename, O_RDWR | O_CREATE, 0666]'
26

DESCRIPTION

28       For the theory of Memoization, please see the Memoize module
29       documentation. This module implements an expiry policy for Memoize that
30       follows LRU semantics, that is, the last n results, where n is
31       specified as the argument to the "CACHESIZE" parameter, will be cached.
32

PERFORMANCE TUNING

34       It is often quite difficult to determine what size cache will give
35       optimal results for a given function. To aid in determining this,
36       ExpireLRU includes cache tuning support. Enabling this causes a
37       definite performance hit, but it is often useful before code is
38       released to production.
39
40       To enable cache tuning support, simply specify the optional
41       "TUNECACHESIZE" parameter with a size greater than that of the
42       "CACHESIZE" parameter.
43
44       When the program exits, a set of statistics will be printed to stderr.
45       If multiple routines have been memoized, separate sets of statistics
46       are printed for each routine. The default names are somewhat cryptic:
47       this is the purpose of the "INSTANCE" parameter. The value of this
48       parameter will be used as the identifier within the statistics report.
49

DIAGNOSTIC METHODS

51       Two additional routines are available but not exported.
52       Memoize::ExpireLRU::ShowStats returns a string identical to the
53       statistics report printed to STDERR at the end of the program if test
54       caches have been enabled; Memoize::ExpireLRU::DumpCache takes the
55       instance name of a memoized function as a parameter, and returns a
56       string describing the current state of that instance.
57

SEE ALSO

59       Memoize
60

REPOSITORY

62       <https://github.com/neilb/Memoize-ExpireLRU>
63

AUTHOR

65       Brent B. Powers (B2Pi), Powers@B2Pi.com
66
68       This software is copyright (c) 1999 by Brent B. Powers.
69
70       This is free software; you can redistribute it and/or modify it under
71       the same terms as the Perl 5 programming language system itself.
72
73
74
75perl v5.32.1                      2021-01-27             Memoize::ExpireLRU(3)
Impressum