template::set_cached_result (private)

 template::set_cached_result

Defined in packages/acs-templating/tcl/query-procs.tcl

Places a query result in the appropriate cache.

Partial Call Graph (max 5 caller/called nodes):
%3 template::query template::query (public) template::set_cached_result template::set_cached_result template::query->template::set_cached_result

Testcases:
No testcase defined.
Source code:

    upvar opts opts

    if { ! [info exists opts(result)] } {
        return
    }

    set cache_key $opts(cache)

    if { [info exists opts(persistent)] } {
        #
        # calculate the timeout
        #
        if { [info exists opts(timeout)] } {
            set timeout [expr {[ns_time] + $opts(timeout)}]
        } else {
            set timeout [expr {[ns_time] + 60 * 60 * 24 * 7}]
        }

        if {[ns_info name] eq "NaviServer"} {
            #
            # NaviServer allows per entry expire time
            #
            ns_cache_eval -expires $timeout -force template_query_cache $cache_key  set _ $opts(result)
        } else {
            #
            # set the cached value as a pair of timeout and value
            #
            ns_cache set template_query_cache $cache_key [list $timeout $opts(result)]
        }

    } else {
        set ::__template_query_request_cache($cache_key$opts(result)
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: