Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.95.2.37 -r1.95.2.38 --- openacs-4/packages/acs-tcl/acs-tcl.info 5 Jan 2022 14:10:22 -0000 1.95.2.37 +++ openacs-4/packages/acs-tcl/acs-tcl.info 8 Jan 2022 15:37:53 -0000 1.95.2.38 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2021-09-15 @@ -18,7 +18,7 @@ GPL version 2 3 - + 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.24 -r1.10.2.25 --- openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 5 Jan 2022 14:16:48 -0000 1.10.2.24 +++ openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 8 Jan 2022 15:37:54 -0000 1.10.2.25 @@ -431,7 +431,8 @@ :public method eval { {-key:required} - {-no_empty:switch false} + {-no_cache} + {-from_cache_indicator} cmd } { # @@ -441,23 +442,37 @@ # @param key key for caching, should start with package-key # and a dot to avoid name clashes # @param cmd command to be executed. - # @return return the last value set (don't use "return"). + # @param no_cache list of returned values that should not be cached + # @param from_cache_indicator variable name to indicate whether + # the returned value was from cache or not # + # @return return the last value set (don't use "return"). + # #set cache_key ${:prefix}$key #ns_log notice "### exists $cache_key => [dict exists ${:prefix} $key]" + if {[info exists from_cache_indicator]} { + :upvar $from_cache_indicator from_cache + } if {![info exists ${:prefix}] || ![dict exists [set ${:prefix}] $key]} { #ns_log notice "### call cmd <$cmd>" + set from_cache 0 set value [:uplevel $cmd] - #ns_log notice "### cmd returns <$value> no_empty $no_empty " - if {$no_empty && $value eq ""} { - return "" + if {[info exists no_cache] && $value in $no_cache} { + #ns_log notice "### cache eval $key returns <$value> without caching" + return $value } + #if {$value eq "0"} { + # ns_log notice "### cache eval $key returns <$value> with caching" + #} dict set ${:prefix} $key $value #ns_log notice "### [list dict set ${:prefix} $key $value]" + } else { + set from_cache 1 + set value [dict get [set ${:prefix}] $key] } #ns_log notice "### will return [list dict get ${:prefix} $key]" - return [dict get [set ${:prefix}] $key] + return $value } :public method flush { Index: openacs-4/packages/acs-tcl/tcl/defs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/defs-procs.tcl,v diff -u -r1.81.2.14 -r1.81.2.15 --- openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 5 Jan 2022 13:10:51 -0000 1.81.2.14 +++ openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 8 Jan 2022 15:37:54 -0000 1.81.2.15 @@ -515,7 +515,7 @@ # (without this we see on some sites > 100 locks on this nsv # per request). # - set dict [acs::per_request_cache eval -no_empty -key acs-tcl.ad_param-$key { + set dict [acs::per_request_cache eval -no_cache "" -key acs-tcl.ad_param-$key { if {[nsv_get ad_param $key result]} { #ns_log notice "ad_parameter_cache $key $parameter_name not cached" set result