GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ALZABO::RUNTIME::UNIQUEROWCACHE (3)

.ds Aq ’

NAME

Alzabo::Runtime::UniqueRowCache - Implements a row cache for Alzabo

CONTENTS

SYNOPSIS



  use Alzabo::Runtime::UniqueRowCache;

  Alzabo::Runtime::UniqueRowCache->clear();



DESCRIPTION

This is a very simple caching mechanism for Alzabo::Runtime::Row objects that tries to ensure that for there is never more than one row object in memory for a given database row.

To use it, simply load it.

It can be foiled through the use of Storable or other deep magic cloning code, like in the Clone module.

The cache is a simple hash kept in memory. If you use this module, you are responsible for clearing the cache as needed. The only time it is cleared automatically is when a table update or delete is performed, in which case all cached rows for that table are cleared.

In a persistent environment like mod_perl, you should clear the cache on a regular basis in order to prevent the cache from getting out of sync with the database. A good way to do this is to clear it at the start of every request.

METHODS

All methods provided are class methods.
o clear

This clears the entire cache

o clear_table( $table_object )

Given a table object, this method clears all the cached rows from that table.

o row_in_cache( $table_name, $row_id )

Given a table name and a row id, as returned by the Alzabo::Runtime::Row->id_as_string method, this method returns the matching row from the cache, if it exists. Otherwise it returns undef.

o delete_from_cache( $table_name, $row_id )

Given a table name and a row id, as returned by the Alzabo::Runtime::Row->id_as_string method, this method returns the matching row from the cache.

o write_to_cache( $row_object )

Given a row object, this method stores it in the cache.

AVOIDING THE CACHE

If you want to not cache a row, then you can pass the no_cache parameter to any table or schema method that creates a new row object or a cursor, such as Alzabo::Runtime::Table->insert(), Alzabo::Runtime::Table->rows_where().

AUTHOR

Dave Rolsky, <autarch@urth.org>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ALZABO::RUNTIME::UNIQUEROWCACHE (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.