[Koha-bugs] [Bug 7248] Caching for services
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon May 14 13:28:53 CEST 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7248
--- Comment #40 from Paul Poulain <paul.poulain at biblibre.com> ---
Created attachment 9554
-->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=9554&action=edit
Bug 7248/7249 follow-up: more generic cache handling
This patch update the cache handling to Koha::Cache. So, whatever the cache
mechanism is, Koha caching will work this way:
use Koha::Cache;
my $cache = Koha::Cache->new();
if ($cache) {
$cache->get_from_cache($identifier)
}
if ($cache) {
$cache->set_in_cache( $identifier,
$value, $cache_expiry );
}
Test plan:
* setup a Koha with MEMCACHE activated (MEMCACHED_NAMESPACE is defined in
koha-httpd.conf)
* setup Koha with DEBUG on (SetEnv DEBUG "1" in koha-httpd.conf)
* restart Apache
* load a report $KOHA/cgi-bin/koha/svc/report?id=<ID>
In the Apache logs you will get:
* report: We have and will use a cache at
/home/paul/koha.dev/koha-community/opac/svc/report line 40.
=> confirmation we will use memcache
* execute_query(<A QUERY>)
=> the cache is still empty, we run the SQL
load the report again, you'll get:
* report: We have and will use a cache at
/home/paul/koha.dev/koha-community/opac/svc/report line 40.
=> confirmation we will use memcache
* report: Report <ID> retrieved from cache at
/home/paul/koha.dev/koha-community/opac/svc/report line 43.
=> confirmation we are retrieving the result from the cache
Remove the MEMCACHE env variable, restart Apache, reload the page, you'll get:
* report: No caching system at /home/paul/koha.dev/koha-community/Koha/Cache.pm
line 75.
=> confirmation you have no caching system active
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list