1 package Koha
::Cache
::Memory
::Lite
;
3 # Copyright 2016 Koha Development Team
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
22 Koha::Cache::Memory::Lite - Handling caching of objects in memory *only* for Koha
26 use Koha::Cache::Memory::Lite;
27 my $cache = Koha::Cache::Memory::Lite->get_instance();
28 $cache->set($key, $value);
29 my $retrieved_from_cache_value = $cache->get($key);
30 $cache->clear_from_cache($key);
35 Koha in memory only caching routines.
41 use base
qw(Class::Accessor);
48 $singleton_cache = $class->new() unless $singleton_cache;
49 return $singleton_cache;
53 my ( $self, $key ) = @_;
54 return $L1_cache{$key};
58 my ( $self, $key, $value ) = @_;
59 $L1_cache{$key} = $value;
62 sub clear_from_cache
{
63 my ( $self, $key ) = @_;
64 delete $L1_cache{$key};