use JSON;
use CGI;
+use Koha::Cache;
+
+
my $query = CGI->new();
my $report = $query->param('id');
my $cache;
-my $usecache = C4::Context->ismemcached;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
-if ($usecache) {
- require Koha::Cache;
- Koha::Cache->import();
- $cache = Koha::Cache->new(
- {
- 'cache_type' => 'memcached',
- 'cache_servers' => $ENV{'MEMCACHED_SERVERS'}
- }
- );
- my $namespace = $ENV{'MEMCACHED_NAMESPACE'} || 'koha';
- my $page = $cache->get_from_cache("$namespace:intranet:report:$report");
+if (Koha::Cache->is_cache_active) {
+ $cache = Koha::Cache->new();
+ my $page = $cache->get_from_cache("intranet:report:$report");
if ($page) {
print $query->header;
print $page;
my $json_text = to_json($lines);
print $json_text;
-if ($usecache) {
- my $namespace = $ENV{'MEMCACHED_NAMESPACE'} || 'koha';
- $cache->set_in_cache( "$namespace:intranet:report:$report",
- $json_text, $cache_expiry );
+if (Koha::Cache->is_cache_active) {
+ $cache->set_in_cache( "intranet:report:$report", $json_text, $cache_expiry );
}