util_memoize (public)

 util_memoize script [ max_age ]

Defined in packages/acs-tcl/tcl/memoize-procs-naviserver.tcl

If script has been executed before, return the value it returned last time, unless it was more than max_age seconds ago.

Otherwise, evaluate script and cache and return the result.

Note: script is not evaluated with uplevel.

Parameters:
script (required)
A Tcl script whose value should be memoized. May be best to pass this as a list, e.g. [list someproc $arg1 $arg2].
max_age (optional)
The maximum age in seconds for the cached value of script. If the cached value is older than max_age seconds, script will be re-executed.
Returns:
The possibly-cached value returned by script.

Partial Call Graph (max 5 caller/called nodes):
%3 test_util_memoize_cache util_memoize_cache (test acs-tcl) util_memoize util_memoize test_util_memoize_cache->util_memoize test_util_memoize_cache_flush util_memoize_cache_flush (test acs-tcl) test_util_memoize_cache_flush->util_memoize test_util_memoize_cache_script util_memoize_cache_script (test acs-tcl) test_util_memoize_cache_script->util_memoize Class ::xowiki::includelet::random-form-page Class ::xowiki::includelet::random-form-page (public) Class ::xowiki::includelet::random-form-page->util_memoize acs::root_of_host_noncached acs::root_of_host_noncached (private) acs::root_of_host_noncached->util_memoize acs_lookup_magic_object acs_lookup_magic_object (private, deprecated) acs_lookup_magic_object->util_memoize acs_object::package_id acs_object::package_id (public) acs_object::package_id->util_memoize acs_object_type::get_table_name acs_object_type::get_table_name (public) acs_object_type::get_table_name->util_memoize

Testcases:
util_memoize_cache, util_memoize_cache_script, util_memoize_cache_flush
[ show source ]
Show another procedure: