1CHI::Driver::Memory(3)User Contributed Perl DocumentationCHI::Driver::Memory(3)
2
3
4

NAME

6       CHI::Driver::Memory - In-process memory based cache
7

VERSION

9       version 0.60
10

SYNOPSIS

12           use CHI;
13
14           my $hash = {};
15           my $cache = CHI->new( driver => 'Memory', datastore => $hash );
16
17           my $cache = CHI->new( driver => 'Memory', global => 1 );
18
19           my $cache = CHI->new( driver => 'Memory', global => 0 );
20

DESCRIPTION

22       This cache driver stores data on a per-process basis.  This is the
23       fastest of the cache implementations, but data can not be shared
24       between processes.  Data will remain in the cache until cleared,
25       expired, or the process dies.
26
27       To maintain the same semantics as other caches, references to data
28       structures are deep-copied on set and get. Thus, modifications to the
29       original data structure will not affect the data structure stored in
30       the cache, and vice versa. See CHI::Driver::RawMemory for a faster
31       memory cache that sacrifices this behavior.
32

CONSTRUCTOR OPTIONS

34       When using this driver, the following options can be passed to
35       CHI->new() in addition to the CHI. One of datastore or global must be
36       specified, or else a warning (possibly an error eventually) will be
37       thrown.
38
39       datastore [HASHREF]
40           A reference to a hash to be used for storage. Within the hash, each
41           namespace is used as a key to a second-level hash.  This hash may
42           be passed to multiple CHI::Driver::Memory constructors.
43
44       global [BOOL]
45           Use a standard global datastore. Multiple caches created with this
46           set to true will see the same data. Before 0.21, this was the
47           default behavior; now it must be specified explicitly (to avoid
48           accidentally sharing the same datastore in unrelated code).
49
50           If this is set to false then datastore will be set to a new
51           reference to a hash.
52

DISCARD POLICY

54       For size aware caches, this driver implements an 'LRU' policy, which
55       discards the least recently used items first. This is the default
56       policy.
57

SEE ALSO

59       CHI::Driver::RawMemory, CHI
60

AUTHOR

62       Jonathan Swartz <swartz@pobox.com>
63
65       This software is copyright (c) 2012 by Jonathan Swartz.
66
67       This is free software; you can redistribute it and/or modify it under
68       the same terms as the Perl 5 programming language system itself.
69
70
71
72perl v5.32.0                      2020-07-28            CHI::Driver::Memory(3)
Impressum