acs::LockfreeCache method flush (public)

 <instance of acs::LockfreeCache[i]> flush [ -pattern pattern ]

Defined in packages/acs-tcl/tcl/acs-cache-procs.tcl

Flush a cache entry based on the pattern (which might be wild-card-free). Currently, the clusterwide flushing is omitted. We have the per-request cache (clusterwide operations do not make sense for this) and per-thread caching. The per-thread caching application have to be aware that flushing is happening only in one thread, so clusterwide operations will only start to make sense, when the all threads of a server would be cleaned.

Switches:
-pattern (optional, defaults to "*")

Testcases:
No testcase defined.
Source code:
if {[info exists ${:prefix}]} {
    if {$pattern eq "*"} {
        #ns_log notice "### dict flush ${:prefix} <$pattern>"
        unset -nocomplain ${:prefix}
    } elseif {[string first "*" $pattern] != -1} {
        #
        # A real pattern with wild-card was provided.
        #
        set keys [dict keys [set ${:prefix}$pattern]
        #ns_log notice "### dict flush ${:prefix} <$pattern> -> [llength $keys]"
        foreach key $keys {
            dict unset ${:prefix} $key
        }
    } elseif [dict exists [set ${:prefix}$pattern] {
        #
        # A "pattern" without a wildcard was provided
        #
        dict unset ${:prefix} $pattern
    }
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: