Index: openacs-4/packages/acs-tcl/tcl/20-memoize-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/20-memoize-init.tcl,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/acs-tcl/tcl/20-memoize-init.tcl 12 Apr 2001 16:58:18 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/20-memoize-init.tcl 6 Feb 2006 16:12:24 -0000 1.1.14.1 @@ -6,3 +6,33 @@ ns_cache create util_memoize -size \ [ad_parameter -package_id [ad_acs_kernel_id] MaxSize memoize 200000] + + +# We construct the body of util_memoize_flush differently depending +# on whether clustering is enabled and what command is available for +# cluster-wide flushing. + +if {[llength [info commands ncf.send]] > 0} { + set flush_body { + ncf.send util_memoize $script + } +} elseif {[llength [info commands server_cluster_httpget_from_peers]] > 0} { + set flush_body { + server_cluster_httpget_from_peers "/SYSTEM/flush-memoized-statement.tcl?statement=[ns_urlencode $script]" + } +} else { + set flush_body {} +} + +append flush_body { + ns_cache flush util_memoize $script +} + +ad_proc -public util_memoize_flush {script} { + Forget any cached value for script. If clustering is + enabled, flush the caches on all servers in the cluster. + + @param script The Tcl script whose cached value should be flushed. +} $flush_body + +unset flush_body