Data::...seCache(3pm)
π NAME π
okay bestie, welcome to the Data::ObjectDriver::Driver::BaseCache page β yes, thatβs the 3pm section, User Contributed Perl Documentation, weβre fancy like that. This class is the parent class for caching object drivers. Slay.
β¨ SYNOPSIS β¨
ngl, the original synopsis section is literally empty. iconic minimalist behavior. the real tea starts below π
π¦ 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. periodt.
πΈ 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%paramsare:cacheβ The object with which to interface with the external cache. For example, for theMemcachedcaching object driver, the value of thecachemember should be aCache::Memcachedobject.fallbackβ TheData::ObjectDriverobject driver to which to fall back when the cache does not yet contain a requested object. Thefallbackmember 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.
bestie, important note: 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. thatβs the warning, do not ignore it π
π§ 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_keyto 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_keyto 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$classcontaining the data in the representation$obj_repr, as returned from theget_from_cachemethod.
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 givenData::ObjectDriver::BaseObjectinstance, suitable for passing to theadd_to_cacheandupdate_cachemethods.
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.
okay thatβs the whole page, bestie β much love from the User Contributed Perl Documentation, perl v5.42.0, dated 2024-10-24. bye and slay π
β¨π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-Data-ObjectDriver 0.230.0-bp160.1.12 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms