Bug 11921: Restore memcached infos to koha-conf - Koha::Config
[koha.git] / Koha / Caches.pm
1 package Koha::Caches;
2
3 use Modern::Perl;
4 use Koha::Cache;
5
6 our $singleton_caches;
7 sub get_instance {
8     my ($class, $subnamespace) = @_;
9     $subnamespace //= '';
10     $singleton_caches->{$subnamespace} = Koha::Cache->new({}, { subnamespace => $subnamespace } ) unless $singleton_caches->{$subnamespace};
11     return $singleton_caches->{$subnamespace};
12 }
13
14 sub flush_L1_caches {
15     return unless $singleton_caches;
16     for my $cache ( values %$singleton_caches ) {
17         $cache->flush_L1_cache;
18     }
19 }
20
21 1;