acs::SiteNodesCache method flush_cache (public)
<instance of acs::SiteNodesCache> flush_cache -node_id node_id \ [ -with_subtree on|off ] [ -url url ]
Defined in packages/acs-tcl/tcl/site-nodes-procs.tcl
Flush entries from site-node tree, including the current node, the root of flushed (sub)tree. If the node_id is not provided, or it is the node_id of root of the full site-node tree, flush the whole tree.
- Switches:
- -node_id (required)
- -with_subtree (optional, boolean, defaults to
"true"
)- -url (optional)
- Testcases:
- No testcase defined.
Source code: :flush_per_request_cache set old_url [:get_url -node_id $node_id] if {$node_id eq "" || $old_url eq "/"} { # # When no node_id is given or the URL is specified # as top-url, flush all caches. This happens # e.g. in the regression test. # #ns_log notice "FLUSHALL" ::acs::site_nodes_cache flush_all ::acs::site_nodes_id_cache flush_all ::acs::site_nodes_children_cache flush_all } else { # # Get subtree from db # set sql [subst { WITH RECURSIVE site_node_tree(node_id,parent_id,object_id) AS ( select node_id, parent_id, object_id from site_nodes where node_id = :node_id UNION ALL select child.node_id, child.parent_id, child.object_id from site_node_tree, site_nodes child where child.parent_id = site_node_tree.node_id and :with_subtree ) select [acs::dc map_function_name site_node__url(node_id)], node_id, object_id from site_node_tree }] if {[db_driverkey ""] eq "oracle"} { set sql [string map [list "WITH RECURSIVE" "WITH"] $sql] if { $with_subtree } { set sql [string map [list ":with_subtree" "1 = 1"] $sql] } else { set sql [string map [list ":with_subtree" "1 = 0"] $sql] } } set tree [::acs::dc list_of_lists -prepare integer,boolean dbqd..get_subtree $sql] foreach entry $tree { lassign $entry url node_id object_id foreach key [list $node_id url-$node_id] { ::acs::site_nodes_cache flush -partition_key $node_id $key } if {$object_id ne ""} { ::acs::site_nodes_cache flush -partition_key $object_id urls-$object_id } :flush_pattern -partition_key $node_id get_children-$node_id-* ::acs::site_nodes_children_cache flush -partition_key $node_id has_children-$node_id } regsub {/$} $old_url "" old_url :flush_pattern id-$old_url* }Generic XQL file: packages/acs-tcl/tcl/site-nodes-procs.xql
PostgreSQL XQL file: packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql
Oracle XQL file: packages/acs-tcl/tcl/site-nodes-procs-oracle.xql