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.2 --- 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 4 Jun 2006 00:45:47 -0000 1.2 @@ -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