Bugzilla – Attachment 53764 Details for
Bug 16365
Selectively introduce GetMarcStructure() "unsafe" variant for better performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16365: [QA Follow-up] Add some comment lines to Cache.pm
Bug-16365-QA-Follow-up-Add-some-comment-lines-to-C.patch (text/plain), 2.27 KB, created by
Marcel de Rooy
on 2016-07-28 09:41:54 UTC
(
hide
)
Description:
Bug 16365: [QA Follow-up] Add some comment lines to Cache.pm
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-07-28 09:41:54 UTC
Size:
2.27 KB
patch
obsolete
>From 6e909ea0873c88c86b9d0185451610ad64603d08 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 28 Jul 2016 08:43:48 +0200 >Subject: [PATCH] Bug 16365: [QA Follow-up] Add some comment lines to Cache.pm >Content-Type: text/plain; charset=utf-8 > >Resolve typo inifinite too. >Adds a few lines in order to stress that the thawed key of the L1 >cache SHOULD ONLY be used for unsafe calls, and not be mixed with >regular (safe) calls. > >Test plan: >Nothing to test, but verify the quality of the added comments. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Cache.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index 17babc8..36891a7 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -259,7 +259,10 @@ sub set_in_cache { > > my $flag = '-CF0'; # 0: scalar, 1: frozen data structure > if (ref($value)) { >- # Set in L1 cache as a data structure, initially only in frozen form (for performance reasons) >+ # Set in L1 cache as a data structure >+ # We only save the frozen form: we do want to save $value in L1 >+ # directly in order to protect it. And thawing now may not be >+ # needed, so improves performance. > $value = $L1_encoder->encode($value); > $L1_cache{$key}->{frozen} = $value; > $flag = '-CF1'; >@@ -270,7 +273,7 @@ sub set_in_cache { > } > > $value .= $flag; >- # We consider an expiry of 0 to be inifinite >+ # We consider an expiry of 0 to be infinite > if ( $expiry ) { > return $set_sub > ? $set_sub->( $key, $value, $expiry ) >@@ -322,6 +325,7 @@ sub get_from_cache { > if ( exists $L1_cache{$key} ) { > if (ref($L1_cache{$key})) { > if ($unsafe) { >+ # ONLY use thawed for unsafe calls !!! > $L1_cache{$key}->{thawed} ||= $L1_decoder->decode($L1_cache{$key}->{frozen}); > return $L1_cache{$key}->{thawed}; > } else { >@@ -350,6 +354,7 @@ sub get_from_cache { > eval { $thawed = $L1_decoder->decode($L2_value); }; > return if $@; > $L1_cache{$key}->{frozen} = $L2_value; >+ # ONLY save thawed for unsafe calls !!! > $L1_cache{$key}->{thawed} = $thawed if $unsafe; > return $thawed; > } >-- >1.7.10.4
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 16365
:
50797
|
52409
|
53746
|
53761
|
53762
|
53763
|
53764
|
53847
|
53848
|
53849
|
53850