| Babble documentation | Contained in the Babble distribution. |
Babble::Cache::Class::Hash - In-memory cache storage for Babble::Cache
This module implements the get and set methods for Babble::Cache subclasses that store the entire cache in memory, in a hash.
Retrieve the value of the $key element in the $id key in the $category category of the cache.
Set the value of the $key element, in the $id key in the $category category of the cache, to $value.
Gergely Nagy, algernon@bonehunter.rulez.org
Bugs should be reported at http://bugs.bonehunter.rulez.org/babble.
Babble::Cache
| Babble documentation | Contained in the Babble distribution. |
## Babble/Cache/Class/Hash.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::Class::Hash; use strict; use Carp; use vars qw(@ISA); use Babble::Cache; @ISA = qw(Babble::Cache);
sub get ($$;$) { my ($self, $cat, $id, $key) = @_; if ($key) { return $self->{cachedb}->{$cat}->{$id}->{$key}; } else { return $self->{cachedb}->{$cat}->{$id}; } }
sub set ($$$$) { my ($self, $cat, $id, $key, $value) = @_; $self->{cachedb}->{$cat}->{$id}->{$key} = $value; }
1; # arch-tag: fba24dda-b267-4638-b63a-99104097901e