Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

chi::driver::memory(3pm) [debian man page]

CHI::Driver::Memory(3pm)				User Contributed Perl Documentation				  CHI::Driver::Memory(3pm)

NAME
CHI::Driver::Memory - In-process memory based cache VERSION
version 0.54 SYNOPSIS
use CHI; my $hash = {}; my $cache = CHI->new( driver => 'Memory', datastore => $hash ); my $cache = CHI->new( driver => 'Memory', global => 1 ); 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. 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 vica versa. See CHI::Driver::RawMemory for a faster memory cache that sacrifices this behavior. CONSTRUCTOR OPTIONS
When using this driver, the following options can be passed to CHI->new() in addition to the CHI. One of datastore or global must be specified, or else a warning (possibly an error eventually) will be thrown. 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. global [BOOL] Use a standard global datastore. Multiple caches created with this flag 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). DISCARD POLICY
For CHI/SIZE AWARENESS caches, this driver implements an 'LRU' policy, which discards the least recently used items first. This is the default policy. SEE ALSO
CHI::Driver::RawMemory, CHI AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-30 CHI::Driver::Memory(3pm)

Check Out this Related Man Page

CHI::Stats(3pm) 					User Contributed Perl Documentation					   CHI::Stats(3pm)

NAME
CHI::Stats - Record and report per-namespace cache statistics VERSION
version 0.54 SYNOPSIS
# Turn on statistics collection CHI->stats->enable(); # Perform cache operations # Flush statistics to logs CHI->stats->flush(); ... # Parse logged statistics my $results = CHI->stats->parse_stats_logs($file1, ...); DESCRIPTION
CHI can record statistics, such as number of hits, misses and sets, on a per-namespace basis and log the results to your Log::Any logger. You can then parse the logs to get a combined summary. A single CHI::Stats object is maintained for each CHI root class, and tallies statistics over any number of CHI::Driver objects. Statistics are reported when you call the "flush" method. You can choose to do this once at process end, or on a periodic basis. STATISTICS
The following statistics are tracked: o absent_misses - Number of gets that failed due to item not being in the cache o compute_time_ms - Total time spent computing missed results in compute, in ms (divide by number of computes to get average). i.e. the amount of time spent in the code reference passed as the third argument to compute(). o computes - Number of compute calls o expired_misses - Number of gets that failed due to item expiring o get_errors - Number of caught runtime errors during gets o get_time_ms - Total time spent in get operation, in ms (divide by number of gets to get average) o hits - Number of gets that succeeded o set_key_size - Number of bytes in set keys (divide by number of sets to get average) o set_value_size - Number of bytes in set values (divide by number of sets to get average) o set_time_ms - Total time spent in set operation, in ms (divide by number of sets to get average) o sets - Number of sets o set_errors - Number of caught runtime errors during sets METHODS
enable disable enabled Enable, disable, and query the current enabled status. When stats are enabled, each new cache object will collect statistics. Enabling and disabling does not affect existing cache objects. e.g. my $cache1 = CHI->new(...); CHI->stats->enable(); # $cache1 will not collect statistics my $cache2 = CHI->new(...); CHI->stats->disable(); # $cache2 will continue to collect statistics flush Log all statistics to Log::Any (at Info level in the CHI::Stats category), then clear statistics from memory. There is one log message for each distinct triplet of root class, cache label, and namespace. Each log message contains the string "CHI stats:" followed by a JSON encoded hash of statistics. e.g. CHI stats: {"absent_misses":1,"label":"File","end_time":1338410398,"get_time_ms":5, "namespace":"Foo","root_class":"CHI","set_key_size":6,"set_time_ms":23, "set_value_size":20,"sets":1,"start_time":1338409391} parse_stats_logs (log1, log2, ...) Parses logs output by "CHI::Stats" and returns a listref of stats totals by root class, cache label, and namespace. e.g. [ { root_class => 'CHI', label => 'File', namespace => 'Foo', absent_misses => 100, expired_misses => 200, ... }, { root_class => 'CHI', label => 'File', namespace => 'Bar', ... }, ] Lines with the same root class, cache label, and namespace are summed together. Non-stats lines are ignored. The parser will ignore anything on the line before the "CHI stats:" string, e.g. a timestamp. Each parameter to this method may be a filename or a reference to an open filehandle. SEE ALSO
CHI AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-30 CHI::Stats(3pm)
Man Page