Index: openacs-4/packages/acs-templating/tcl/query-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/query-procs.tcl,v diff -u -N -r1.32 -r1.33 --- openacs-4/packages/acs-templating/tcl/query-procs.tcl 28 Nov 2012 14:52:04 -0000 1.32 +++ openacs-4/packages/acs-templating/tcl/query-procs.tcl 3 Dec 2012 09:44:55 -0000 1.33 @@ -433,7 +433,7 @@ if { [ns_cache names template_query_cache $cache_key] ne ""} { - if {[ns_info name] ne "NaviServer"} { + if {[ns_info name] eq "NaviServer"} { set cached_result [ns_cache_eval template_query_cache $cache_key {}] } else { @@ -517,7 +517,7 @@ # # NaviServer allows per entry expire time # - ns_cache_eval -expires $timeout -force 1 template_query_cache $cache_key \ + ns_cache_eval -expires $timeout -force template_query_cache $cache_key \ set _ $opts(result) } else { # @@ -580,9 +580,9 @@ foreach name $names { if { [string match $cache_match $name] } { ns_log debug "template::query::flush_cache: FLUSHING QUERY (persistent): $name" - nsv_cache flush template_query_cache $name + ns_cache flush template_query_cache $name if {[ns_info name] ne "NaviServer"} { - nsv_cache flush template_timeout_cache $name + ns_cache flush template_timeout_cache $name } } } @@ -1080,8 +1080,8 @@ switch -exact $command { get { - if {[ns_info name] ne "NaviServer"} { - if {[ns_cache_keys template_cache $cache_key]} { + if {[ns_info name] eq "NaviServer"} { + if {[ns_cache_keys template_cache $cache_key] ne ""} { set result [ns_cache_eval template_cache $cache_key {}] } } else { @@ -1106,11 +1106,11 @@ set timeout [expr {[ns_time] + [lindex $args 1]}] } - if {[ns_info name] ne "NaviServer"} { + if {[ns_info name] eq "NaviServer"} { # # NaviServer allows per entry expire time # - ns_cache_eval -expires $timeout -force 1 template_cache $cache_key \ + ns_cache_eval -expires $timeout -force template_cache $cache_key \ set _ [lindex $args 0] } else { # @@ -1122,7 +1122,7 @@ flush { # The key is actually a string match pattern - if {[ns_info name] ne "NaviServer"} { + if {[ns_info name] eq "NaviServer"} { ns_cache_flush -glob template_cache $cache_key } else { set names [ns_cache names template_cache] @@ -1139,15 +1139,17 @@ if {[ns_info name] eq "NaviServer"} { set result [expr {[ns_cache_keys template_cache $cache_key] ne ""}] } else { - if { [ns_cache exists template_cache $cache_key] } { + if { [ns_cache get template_cache $cache_key cached_value] } { # get timeout and value - lassign [ns_cache get template_cache $cache_key] timeout value + lassign $cached_value timeout value # validate timeout if { $timeout > [ns_time] } { set result 1 } else { set result 0 } + } else { + set result 0 } } }