.\" 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 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Data::ObjectDriver::Driver::BaseCache 3pm" .TH Data::ObjectDriver::Driver::BaseCache 3pm "2017-09-30" "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" Data::ObjectDriver::Driver::BaseCache \- parent class for caching object drivers .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SH "DESCRIPTION" .IX Header "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. .SH "USAGE" .IX Header "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: .ie n .SS """Data::ObjectDriver::Driver::BaseCache\->new( %params )""" .el .SS "\f(CWData::ObjectDriver::Driver::BaseCache\->new( %params )\fP" .IX Subsection "Data::ObjectDriver::Driver::BaseCache->new( %params )" Creates a new instance of a BaseCache driver. Required members of \f(CW%params\fR are: .IP "\(bu" 4 \&\f(CW\*(C`cache\*(C'\fR .Sp The object with which to interface with the external cache. For example, for the \f(CW\*(C`Memcached\*(C'\fR caching object driver, the value of the \f(CW\*(C`cache\*(C'\fR member should be a \f(CW\*(C`Cache::Memcached\*(C'\fR object. .IP "\(bu" 4 \&\f(CW\*(C`fallback\*(C'\fR .Sp The \f(CW\*(C`Data::ObjectDriver\*(C'\fR object driver to which to fall back when the cache does not yet contain a requested object. The \f(CW\*(C`fallback\*(C'\fR member is also the object driver to which updates and inserts are passed. .ie n .SS """$driver\->cache_key($class, $primary_key)""" .el .SS "\f(CW$driver\->cache_key($class, $primary_key)\fP" .IX Subsection "$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. .PP In BaseCache's implementation, the key is the class name and all the column names of the primary key concatenated, separated by single colons. .ie n .SS """$driver\->get_multi_from_cache(@cache_keys)""" .el .SS "\f(CW$driver\->get_multi_from_cache(@cache_keys)\fP" .IX Subsection "$driver->get_multi_from_cache(@cache_keys)" Returns the objects corresponding to the given cache keys, as represented in the external cache. .ie n .SS """Data::ObjectDriver::Driver::BaseClass\->Disabled([ $value ])""" .el .SS "\f(CWData::ObjectDriver::Driver::BaseClass\->Disabled([ $value ])\fP" .IX Subsection "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 \f(CW$value\fR, if given. When a caching driver is disabled, all operations are automatically passed through to the fallback object driver. .PP Note that, if you disable and re-enable 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. .SH "SUBCLASSING" .IX Header "SUBCLASSING" When creating a caching driver from \f(CW\*(C`BaseCache\*(C'\fR, the behavior for interaction with the external cache (through the \f(CW\*(C`cache\*(C'\fR member of the constructor) must be defined by implementing these methods: .ie n .SS """$driver\->add_to_cache($cache_key, $obj_repr)""" .el .SS "\f(CW$driver\->add_to_cache($cache_key, $obj_repr)\fP" .IX Subsection "$driver->add_to_cache($cache_key, $obj_repr)" Sets the cache entry for \f(CW$cache_key\fR to the given object representation. This method is used when the corresponding object is being saved to the database for the first time. .ie n .SS """$driver\->update_cache($cache_key, $obj_repr)""" .el .SS "\f(CW$driver\->update_cache($cache_key, $obj_repr)\fP" .IX Subsection "$driver->update_cache($cache_key, $obj_repr)" Sets the cache entry for \f(CW$cache_key\fR to the given object representation. This method is used when the corresponding object already exists in the database and is being saved. .ie n .SS """$driver\->remove_from_cache($cache_key)""" .el .SS "\f(CW$driver\->remove_from_cache($cache_key)\fP" .IX Subsection "$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. .ie n .SS """$driver\->get_from_cache($cache_key)""" .el .SS "\f(CW$driver\->get_from_cache($cache_key)\fP" .IX Subsection "$driver->get_from_cache($cache_key)" Returns the object corresponding to the given cache key, as it exists in the external cache. .ie n .SS """$driver\->inflate($class, $obj_repr)""" .el .SS "\f(CW$driver\->inflate($class, $obj_repr)\fP" .IX Subsection "$driver->inflate($class, $obj_repr)" Returns an instance of \f(CW$class\fR containing the data in the representation \&\f(CW$obj_repr\fR, as returned from the \f(CW\*(C`get_from_cache\*(C'\fR method. .PP In BaseCache's implementation, no operation is performed. \f(CW\*(C`get_from_cache\*(C'\fR should itself return the appropriate instances of \&\f(CW\*(C`Data::ObjectDriver::BaseObject\*(C'\fR. .ie n .SS """$driver\->deflate($obj)""" .el .SS "\f(CW$driver\->deflate($obj)\fP" .IX Subsection "$driver->deflate($obj)" Returns a representation of the given \f(CW\*(C`Data::ObjectDriver::BaseObject\*(C'\fR instance, suitable for passing to the \f(CW\*(C`add_to_cache\*(C'\fR and \f(CW\*(C`update_cache\*(C'\fR methods. .PP In BaseCache's implementation, no operation is performed. \f(CW\*(C`add_to_cache\*(C'\fR and \&\f(CW\*(C`update_cache\*(C'\fR should themselves accept \f(CW\*(C`Data::ObjectDriver::BaseObject\*(C'\fR instances. .SH "LICENSE" .IX Header "LICENSE" \&\fIData::ObjectDriver\fR is free software; you may redistribute it and/or modify it under the same terms as Perl itself. .SH "AUTHOR & COPYRIGHT" .IX Header "AUTHOR & COPYRIGHT" Except where otherwise noted, \fIData::ObjectDriver\fR is Copyright 2005\-2006 Six Apart, cpan@sixapart.com. All rights reserved.