Forum OpenACS Q&A: Re: Problems defining procs

Collapse
Posted by Jeff Rogers on
The util_memoize procs are for exactly this purpose - run something once and return it quickly after that.

https://openacs.org/api-doc/procs-file-view?version_id=2967965&path=packages/acs-tcl/tcl/memoize-procs.tcl

You can wrap it in a proc very easily too, for example:

proc get_values {} {
return [util_memoize get_values_internal 86400]
}

proc get_values_internal {} {
# do slow/heavy database access
return $values
}