Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

html::mason::cache::basecache(3pm) [debian man page]

HTML::Mason::Cache::BaseCache(3pm)			User Contributed Perl Documentation			HTML::Mason::Cache::BaseCache(3pm)

NAME
HTML::Mason::Cache::BaseCache - Base cache object DESCRIPTION
This is the base module for all cache implementations used in Mason. It provides a few additional methods on top of "Cache::BaseCache" in Dewitt Clinton's "Cache::Cache" package. An object of this class is returned from $m->cache. METHODS
clear () Remove all values in the cache. get (key, [%params]) Returns the value associated with key or undef if it is non-existent or expired. This is extended with the following optional name/value parameters: busy_lock => duration If the value has expired, set its expiration time to the current time plus duration (instead of removing it from the cache) before returning undef. This is used to prevent multiple processes from recomputing the same expensive value simultaneously. The duration may be of any form acceptable to set. expire_if => sub If the value exists and has not expired, call sub with the cache object as a single parameter. If sub returns a true value, expire the value. get_object (key) Returns the underlying "Cache::Object" object associated with key. The most useful methods on this object are $co->get_created_at(); # when was object stored in cache $co->get_accessed_at(); # when was object last accessed $co->get_expires_at(); # when does object expire expire (key) Expires the value associated with key, if it exists. Differs from remove only in that the cache object is left around, e.g. for retrieval by get_object. remove (key) Removes the cache object associated with key, if it exists. set (key, data, [duration]) Associates data with key in the cache. duration indicates the time until the value should be erased. If duration is unspecified, the value will never expire by time. $expires_in may be a simple number of seconds, or a string of the form "[number] [unit]", e.g., "10 minutes". The valid units are s, second, seconds, sec, m, minute, minutes, min, h, hour, hours, d, day, days, w, week, weeks, M, month, months, y, year, and years. perl v5.14.2 2012-02-04 HTML::Mason::Cache::BaseCache(3pm)

Check Out this Related Man Page

Data::ObjectDriver::Driver::BaseCache(3pm)		User Contributed Perl Documentation		Data::ObjectDriver::Driver::BaseCache(3pm)

NAME
Data::ObjectDriver::Driver::BaseCache - parent class for caching object drivers SYNOPSIS
DESCRIPTION
Data::ObjectDriver::Driver::BaseCache provides behavior utilized for all caching object drivers for use with Data::ObjectDriver. That behavior is looking up requested objects in a cache, and falling back to another Data::ObjectDriver for a cache miss. USAGE
Drivers based on Data::ObjectDriver::Driver::BaseCache support all standard operations for Data::ObjectDriver object drivers (lookup, search, update, insert, replace, remove, and fetch_data). BaseCache-derived drivers also support: "Data::ObjectDriver::Driver::BaseCache->new( %params )" Creates a new instance of a BaseCache driver. Required members of %params are: o "cache" The object with which to interface with the external cache. For example, for the "Memcached" caching object driver, the value of the "cache" member should be a "Cache::Memcached" object. o "fallback" The "Data::ObjectDriver" object driver to which to fall back when the cache does not yet contain a requested object. The "fallback" member is also the object driver to which updates and inserts are passed. "$driver->cache_key($class, $primary_key)" Returns the cache key for an object of the given class with the given primary key. The cache key is used with the external cache to identify an object. In BaseCache's implementation, the key is the class name and all the column names of the primary key concatenated, separated by single colons. "$driver->get_multi_from_cache(@cache_keys)" Returns the objects corresponding to the given cache keys, as represented in the external cache. "Data::ObjectDriver::Driver::BaseClass->Disabled([ $value ])" Returns whether caches of the given class are disabled, first updating the disabled state of drivers of the given class to $value, if given. When a caching driver is disabled, all operations are automatically passed through to the fallback object driver. Note that, if you disable and reenable a caching driver, some of the cached data may be invalid due to updates that were performed while the driver was disabled not being reflected in the external cache. SUBCLASSING
When creating a caching driver from "BaseCache", the behavior for interaction with the external cache (through the "cache" member of the constructor) must be defined by implementing these methods: "$driver->add_to_cache($cache_key, $obj_repr)" Sets the cache entry for $cache_key to the given object representation. This method is used when the corresponding object is being saved to the database for the first time. "$driver->update_cache($cache_key, $obj_repr)" Sets the cache entry for $cache_key to the given object representation. This method is used when the corresponding object already exists in the database and is being saved. "$driver->remove_from_cache($cache_key)" Clears the given cache entry. This method is used when the corresponding object is being deleted from the database. "$driver->get_from_cache($cache_key)" Returns the object corresponding to the given cache key, as it exists in the external cache. "$driver->inflate($class, $obj_repr)" Returns an instance of $class containing the data in the representation $obj_repr, as returned from the "get_from_cache" method. In BaseCache's implementation, no operation is performed. "get_from_cache" should itself return the appropriate instances of "Data::ObjectDriver::BaseObject". "$driver->deflate($obj)" Returns a representation of the given "Data::ObjectDriver::BaseObject" instance, suitable for passing to the "add_to_cache" and "update_cache" methods. In BaseCache's implementation, no operation is performed. "add_to_cache" and "update_cache" should themselves accept "Data::ObjectDriver::BaseObject" instances. LICENSE
Data::ObjectDriver is free software; you may redistribute it and/or modify it under the same terms as Perl itself. AUTHOR &; COPYRIGHT Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006 Six Apart, cpan@sixapart.com. All rights reserved. perl v5.12.4 2011-08-29 Data::ObjectDriver::Driver::BaseCache(3pm)
Man Page