.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "CHI::Driver::Memory 3pm" .TH CHI::Driver::Memory 3pm "2017-07-31" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CHI::Driver::Memory \- In\-process memory based cache .SH "VERSION" .IX Header "VERSION" version 0.60 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use CHI; \& \& my $hash = {}; \& my $cache = CHI\->new( driver => \*(AqMemory\*(Aq, datastore => $hash ); \& \& my $cache = CHI\->new( driver => \*(AqMemory\*(Aq, global => 1 ); \& \& my $cache = CHI\->new( driver => \*(AqMemory\*(Aq, global => 0 ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This cache driver stores data on a per-process basis. This is the fastest of the cache implementations, but data can not be shared between processes. Data will remain in the cache until cleared, expired, or the process dies. .PP To maintain the same semantics as other caches, references to data structures are deep-copied on set and get. Thus, modifications to the original data structure will not affect the data structure stored in the cache, and vice versa. See CHI::Driver::RawMemory for a faster memory cache that sacrifices this behavior. .SH "CONSTRUCTOR OPTIONS" .IX Header "CONSTRUCTOR OPTIONS" When using this driver, the following options can be passed to \s-1CHI\-\s0>\fInew()\fR in addition to the \s-1CHI\s0. One of \&\fIdatastore\fR or \fIglobal\fR must be specified, or else a warning (possibly an error eventually) will be thrown. .IP "datastore [\s-1HASHREF\s0]" 4 .IX Item "datastore [HASHREF]" A reference to a hash to be used for storage. Within the hash, each namespace is used as a key to a second-level hash. This hash may be passed to multiple CHI::Driver::Memory constructors. .IP "global [\s-1BOOL\s0]" 4 .IX Item "global [BOOL]" Use a standard global datastore. Multiple caches created with this set to true will see the same data. Before 0.21, this was the default behavior; now it must be specified explicitly (to avoid accidentally sharing the same datastore in unrelated code). .Sp If this is set to false then datastore will be set to a new reference to a hash. .SH "DISCARD POLICY" .IX Header "DISCARD POLICY" For size aware caches, this driver implements an '\s-1LRU\s0' policy, which discards the least recently used items first. This is the default policy. .SH "SEE ALSO" .IX Header "SEE ALSO" CHI::Driver::RawMemory, \s-1CHI\s0 .SH "AUTHOR" .IX Header "AUTHOR" Jonathan Swartz .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2012 by Jonathan Swartz. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.