| OpenFrame-WebApp documentation | Contained in the OpenFrame-WebApp distribution. |
OpenFrame::WebApp::Session::CacheBase - abstract base for sessions using Cache::Cache modules
# abstract class - cannot be instantiated use base qw( OpenFrame::WebApp::Session::CacheBase );
An OpenFrame::WebApp::Session for using Cache::Cache modules.
Steve Purkis <spurkis@epn.nu>
Based on OpenFrame::AppKit::Session, by James A. Duncan.
Copyright (c) 2003 Steve Purkis. All rights reserved. Released under the same license as Perl itself.
Cache::Cache, OpenFrame::WebApp::Sesssion, OpenFrame::WebApp::Session::MemCache, OpenFrame::WebApp::Session::FileCache
| OpenFrame-WebApp documentation | Contained in the OpenFrame-WebApp distribution. |
package OpenFrame::WebApp::Session::CacheBase; use strict; use warnings::register; use Error; use OpenFrame::WebApp::Error::Abstract; our $VERSION = (split(/ /, '$Revision: 1.1 $'))[1]; use base qw( OpenFrame::WebApp::Session ); sub cache_class { my $self = shift; throw OpenFrame::WebApp::Error::Abstract( class => ref($self) ); } sub store { my $self = shift; my $expiry = $self->get_expiry_seconds; my @args = ($self->id, $self); push (@args, "$expiry s") if (defined $expiry); $self->cache_class->new()->set( @args ); return $self->id; } sub fetch { my $class = shift; my $id = shift || return; return $class->cache_class->new({auto_purge_on_get => 1})->get( $id ); } sub remove { my $self = shift; my $id = ref($self) ? $self->id : shift; $self->cache_class->new()->remove( $id ); return $self; } 1;