| Babble documentation | Contained in the Babble distribution. |
Babble::Cache::Storable - Storable-based cache for Babble
This module implements a cache for Babble that uses Storable to store and retrieve the cache. The cache itself is stored in memory in a hash (thus, this class is a subclass of Babble::Cache::Class::Hash).
The main advantage is speed, but the stored cache is not human readable.
Load the cache stored in Storable format from the file specified during object creation.
Save the cache in Storable format to the file specified during object creation.
Gergely Nagy, algernon@bonehunter.rulez.org
Bugs should be reported at http://bugs.bonehunter.rulez.org/babble.
Storable, Babble, Babble::Cache, Babble::Cache::Class::Hash
| Babble documentation | Contained in the Babble distribution. |
## Babble/Cache/Storable.pm ## Copyright (C) 2004 Gergely Nagy <algernon@bonehunter.rulez.org> ## ## This file is part of Babble. ## ## Babble is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; version 2 dated June, 1991. ## ## Babble is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package Babble::Cache::Storable; use strict; use Storable; use Babble::Cache::Class::Hash; use vars qw(@ISA); @ISA = qw(Babble::Cache::Class::Hash);
sub load () { my $self = shift; return 1 unless ($self->{-cache_fn} && -e $self->{-cache_fn}); $self->{cachedb} = Storable::retrieve $self->{-cache_fn}; }
sub dump () { my $self = shift; return unless $self->{-cache_fn}; Storable::store $self->{cachedb}, $self->{-cache_fn}; }
1; # arch-tag: bbb35e90-13d8-480c-b700-f6a5603e2680