John Drago


Class::DBI::Lite::CacheManager::Memcached - Cache via memcached.


  package app::user;
  use strict;
  use warnings 'all';
  use base 'app::model';
  use Class::DBI::Lite::CacheManager::Memcached;
      lifetime        => '30s',
      class           => __PACKAGE__,
      servers         => [''],
      do_cache_search => 1,

Then, someplace else...

  # This will be cached...
  my ($user) = app::user->search(
    email     => '',
    password  => 'whiterabbit',


  # This won't hit the database - the result will come from the cache instead:
  my ($user) = app::user->search(
    email     => '',
    password  => 'whiterabbit',

A create, update or delete invalidates the cache:

  $user->delete; # Cache is emptied now.


Class::DBI::Lite::CacheManager::Memcached uses Cache::Memcached to temporarily store the results of (presumably) frequent database searches for faster lookup.

So, if your data requirements are such that you find objects of a specific class are getting called up frequently enough to warrant caching - you can now do that on a per-class basis.

You can even specify the kinds of search queries that should be cached.

You can specify the length of time that cached data should be available.

NOTE: More documentation and complete examples TBD.


Copyright John Drago <>. All rights reserved.


This software is Free software and may be used and redistributed under the same terms as perl itself.