Index: openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl,v diff -u -r1.10.2.1 -r1.10.2.2 --- openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 30 Mar 2020 19:30:39 -0000 1.10.2.1 +++ openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 7 Apr 2020 09:17:29 -0000 1.10.2.2 @@ -266,8 +266,8 @@ :public method flush_all {{-partition_key ""}} { # - # Flush all entries in all caches. Both, NaviServer and - # AOLserver support "ns_cache_flush". + # Flush all entries in all partitions of a cache. Both, + # NaviServer and AOLserver support "ns_cache_flush". # for {set i 0} {$i < ${:partitions}} {incr i} { ns_cache_flush ${:name}-$i @@ -276,6 +276,34 @@ } } + if {[info commands ns_cache_eval] ne ""} { + # + # NaviServer variant + # + :public method flush_all_pattern {{-partition_key ""} pattern} { + # + # Flush matching entries in all partitions of a cache based on + # a pattern. + # + for {set i 0} {$i < ${:partitions}} {incr i} { + ns_cache_flush -glob ${:name}-$i $pattern + ns_log notice "flush_all_pattern: ns_cache_flush ${:name}-$i $pattern" + #ns_log notice "... content of ${:name}-$i: [ns_cache_keys ${:name}-$i]" + } + } + } else { + # + # AOLserver variant + # + :public method flush_all_pattern {{-partition_key ""} pattern} { + for {set i 0} {$i < ${:partitions}} {incr i} { + foreach name [ns_cache names ${:name}-$i $pattern] { + :flush -partition_key $partition_key $name + } + } + } + } + :public method show_all {} { for {set i 0} {$i < ${:partitions}} {incr i} { ns_log notice "content of ${:name}-$i: [ns_cache_keys ${:name}-$i]" @@ -329,7 +357,7 @@ # # flush just in the determined partition # - next [list -partition_key [ns_hash $partition_key] $pattern] + :flush_all_pattern -partition_key $partition_key $pattern } :public method flush {{-partition_key:required} key} {