Bugzilla – Attachment 161049 Details for
Bug 35793
Remove Koha::Template::Plugin::Cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35793: Remove Koha::Template::Plugin::Cache
Bug-35793-Remove-KohaTemplatePluginCache.patch (text/plain), 3.96 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-01-15 18:11:14 UTC
(
hide
)
Description:
Bug 35793: Remove Koha::Template::Plugin::Cache
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-01-15 18:11:14 UTC
Size:
3.96 KB
patch
obsolete
>From 11ca846708bd0245e4e85c94fbd9e2cc5df2e9a7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 12 Jan 2024 15:39:35 +0100 >Subject: [PATCH] Bug 35793: Remove Koha::Template::Plugin::Cache > >Introduced in 2011 by bug 7387 but has never been used. >Removing it. > >Test plan: > git grep Cache **/*.tt **/*.inc >should not return relevant results. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Template/Plugin/Cache.pm | 118 ---------------------------------- > 1 file changed, 118 deletions(-) > delete mode 100644 Koha/Template/Plugin/Cache.pm > >diff --git a/Koha/Template/Plugin/Cache.pm b/Koha/Template/Plugin/Cache.pm >deleted file mode 100644 >index 93bbf0f24df..00000000000 >--- a/Koha/Template/Plugin/Cache.pm >+++ /dev/null >@@ -1,118 +0,0 @@ >-package Koha::Template::Plugin::Cache; >- >-# Copyright Catalyst IT 2011 >- >-# This file is part of Koha. >-# >-# Koha 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; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha 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 Koha; if not, see <http://www.gnu.org/licenses>. >- >-use strict; >-use warnings; >-use base qw( Template::Plugin ); >-use Template::Plugin; >-use C4::Context; >- >-#------------------------------------------------------------------------ >-# new(\%options) >-#------------------------------------------------------------------------ >- >-sub new { >- my ( $class, $context, $params ) = @_; >- my $cache; >- if ( $params->{cache} ) { >- $cache = delete $params->{cache}; >- } >- else { >- require Koha::Cache; >- $cache = Koha::Caches->get_instance(); >- } >- my $self = bless { >- CACHE => $cache, >- CONFIG => $params, >- CONTEXT => $context, >- }, $class; >- return $self; >-} >- >-#------------------------------------------------------------------------ >-# $cache->include({ >-# template => 'foo.html', >-# keys => {'user.name', user.name}, >-# ttl => 60, #seconds >-# }); >-#------------------------------------------------------------------------ >- >-sub inc { >- my ( $self, $params ) = @_; >- $self->_cached_action( 'include', $params ); >-} >- >-sub proc { >- my ( $self, $params ) = @_; >- $self->_cached_action( 'process', $params ); >-} >- >-sub _cached_action { >- my ( $self, $action, $params ) = @_; >- my $key; >- if ( $params->{key} ) { >- $key = delete $params->{key}; >- } >- else { >- my $cache_keys = $params->{keys}; >- $key = join( >- ':', >- ( >- $params->{template}, >- map { "$_=$cache_keys->{$_}" } keys %{$cache_keys} >- ) >- ); >- } >- my $result = $self->{CACHE}->get_from_cache($key); >- if ( !$result ) { >- $result = $self->{CONTEXT}->$action( $params->{template} ); >- $self->{CACHE} >- ->set_in_cache( $key, $result, { expiry => $params->{ttl} } ); >- } >- return $result; >-} >- >-1; >- >-=head1 NAME >- >-Koha::Template::Plugin::Cache - cache output of templates >- >-=head1 SYNOPSIS >- >- [% USE cache = Cache %] >- >- >- [% cache.inc( >- 'template' => 'slow.html', >- 'keys' => {'user.name' => user.name}, >- 'ttl' => 360 >- ) %] >- >- # or with a pre-defined Cache::* object and key >- >- [% USE cache = Cache( cache => mycache ) %] >- >- [% cache.inc( >- 'template' => 'slow.html', >- 'key' => mykey, >- 'ttl' => 360 >- ) %] >- >-__END__ >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35793
:
160971
| 161049 |
163703