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.12 -r1.10.2.13 --- openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 6 Dec 2020 08:43:59 -0000 1.10.2.12 +++ openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 27 Jan 2021 20:24:38 -0000 1.10.2.13 @@ -400,8 +400,28 @@ # ########################################################################## nx::Class create acs::LockfreeCache { - :property {prefix } + :property {prefix} + :public method get { + {-key:required} + var + } { + # + # Get entry with the provided key from this cache if it + # exists. In most cases, the "eval" method should be used. + # + # @param key cache key + # @return return boolean value indicating success. + # + set cache_key ${:prefix}$key + if {[info exists $cache_key]} { + :upvar $var value + set value [set $cache_key] + return 1 + } + return 0 + } + :public method eval { {-key:required} {-no_empty:switch false} @@ -435,6 +455,10 @@ :public method flush { {-pattern *} } { + # + # Flush a cache entry based on the pattern (which might be + # wild-card-free). + # set pattern ${:prefix}${pattern} unset -nocomplain {*}[info vars $pattern] }