.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Cache::CacheMetaData 3pm" .TH Cache::CacheMetaData 3pm "2022-06-30" "perl v5.34.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" Cache::CacheMetaData \-\- data about objects in the cache .SH "DESCRIPTION" .IX Header "DESCRIPTION" The CacheMetaData object is used by size aware caches to keep track of the state of the cache and efficiently return information such as an objects size or an ordered list of identifiers to be removed when a cache size is being limited. End users will not normally use CacheMetaData directly. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Cache::CacheMetaData; \& \& my $cache_meta_data = new Cache::CacheMetaData( ); \& \& foreach my $key ( $cache\->get_keys( ) ) \& { \& my $object = $cache\->get_object( $key ) or \& next; \& \& $cache_meta_data\->insert( $object ); \& } \& \& my $current_size = $cache_meta_data\->get_cache_size( ); \& \& my @removal_list = $cache_meta_data\->build_removal_list( ); .Ve .SH "METHODS" .IX Header "METHODS" .IP "\fBnew( )\fR" 4 .IX Item "new( )" Construct a new Cache::CacheMetaData object .IP "\fBinsert( \f(CB$object\fB )\fR" 4 .IX Item "insert( $object )" Inform the CacheMetaData about the object \fI\f(CI$object\fI\fR in the cache. .IP "\fBremove( \f(CB$key\fB )\fR" 4 .IX Item "remove( $key )" Inform the CacheMetaData that the object specified by \fI\f(CI$key\fI\fR is no longer in the cache. .IP "\fBbuild_removal_list( )\fR" 4 .IX Item "build_removal_list( )" Create a list of the keys in the cache, ordered as follows: .Sp 1) objects that expire now .Sp 2) objects expiring at a particular time, with ties broken by the time at which they were least recently accessed .Sp 3) objects that never expire, sub ordered by the time at which they were least recently accessed .Sp \&\s-1NOTE:\s0 This could be improved further by taking the size into account on accessed_at ties. However, this type of tie is unlikely in normal usage. .IP "\fBbuild_object_size( \f(CB$key\fB )\fR" 4 .IX Item "build_object_size( $key )" Return the size of an object specified by \fI\f(CI$key\fI\fR. .SH "PROPERTIES" .IX Header "PROPERTIES" .IP "\fBget_cache_size\fR" 4 .IX Item "get_cache_size" The total size of the objects in the cache .SH "SEE ALSO" .IX Header "SEE ALSO" Cache::Cache, Cache::CacheSizer, Cache::SizeAwareCache .SH "AUTHOR" .IX Header "AUTHOR" Original author: DeWitt Clinton .PP Last author: \f(CW$Author:\fR dclinton $ .PP Copyright (C) 2001\-2003 DeWitt Clinton