From 1155465a48adebe32601c505fc77c76549daf851 Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Mon, 2 Jan 2023 17:15:30 +0100 Subject: [PATCH] - added cache invalidation - fixes warnings --- lib/SLUB/LZA/Rosetta/TA.pm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/SLUB/LZA/Rosetta/TA.pm b/lib/SLUB/LZA/Rosetta/TA.pm index 1d6645c..842997b 100644 --- a/lib/SLUB/LZA/Rosetta/TA.pm +++ b/lib/SLUB/LZA/Rosetta/TA.pm @@ -25,7 +25,7 @@ BEGIN{ %config = YAML::LoadFile($config_path); } $cache_path = $home->child('.cache')->child('ta-tool.cache'); - if ($cache_path->is_file) { + if ($cache_path->is_file and -s $cache_path < 8192*1024) { # if size > 8MB, write new at end, see END{}-block %cache = YAML::LoadFile($cache_path); } } @@ -222,13 +222,17 @@ sub trace_log { return if ( exists( $cache{$file_md5} ) and ( - ( - exists( $cache{$file_md5}->{deposit_dir}->{$deposit_dir}) - and exists( $cache{$file_md5}->{deposit_id}->{$deposit_id}) - and exists( $cache{$file_md5}->{sip_id}->{$sip_id}) + ( exists($cache{$file_md5}->{deposit_dir}) + and exists($cache{$file_md5}->{deposit_id}) + and exists($cache{$file_md5}->{sip_id}) + and exists($cache{$file_md5}->{deposit_dir}->{$searchid}) + and exists($cache{$file_md5}->{deposit_id}->{$searchid}) + and exists($cache{$file_md5}->{sip_id}->{$searchid}) ) or ( - exists( $cache{$file_md5}->{ie_pid}->{$ie_pid}) - and exists( $cache{$file_md5}->{rep_id}{$rep_id}) + exists($cache{$file_md5}->{rep_id}) + and exists($cache{$file_md5}->{ie_pid}) + and exists($cache{$file_md5}->{ie_pid}->{$searchid}) + and exists($cache{$file_md5}->{rep_id}->{$searchid}) ) ) ); @@ -313,11 +317,11 @@ sub trace_log { exists( $cache{$file_md5} ) and ( - exists( $cache{$file_md5}->{deposit_dir}->{$deposit_dir}) - or exists( $cache{$file_md5}->{deposit_id}->{$deposit_id}) - or exists( $cache{$file_md5}->{sip_id}->{$sip_id}) - or exists( $cache{$file_md5}->{ie_pid}->{$ie_pid}) - or exists( $cache{$file_md5}->{rep_id}->{$rep_id}) + (exists ($cache{$file_md5}->{deposit_dir}) and exists($cache{$file_md5}->{deposit_dir}->{$deposit_dir})) + or (exists ($cache{$file_md5}->{deposit_id}) and exists($cache{$file_md5}->{deposit_id}->{$deposit_id})) + or (exists ($cache{$file_md5}->{sip_id}) and exists($cache{$file_md5}->{sip_id}->{$sip_id})) + or (exists ($cache{$file_md5}->{ie_pid}) and exists($cache{$file_md5}->{ie_pid}->{$ie_pid})) + or (exists ($cache{$file_md5}->{rep_id}) and exists($cache{$file_md5}->{rep_id}->{$rep_id})) ) ); while(<$fh>) { -- GitLab