category_tree::flush_cache (public)

 category_tree::flush_cache tree_id

Defined in packages/categories/tcl/category-trees-procs.tcl

Flushes category tree hierarchy cache of one category tree.

Parameters:
tree_id - category tree to be flushed.
Author:
Timo Hentschel <timo@timohentschel.de>

Partial Call Graph (max 5 caller/called nodes):
%3 test_category_tree_procs category_tree_procs (test categories) category_tree::flush_cache category_tree::flush_cache test_category_tree_procs->category_tree::flush_cache db_foreach db_foreach (public) category_tree::flush_cache->db_foreach category::add category::add (public) category::add->category_tree::flush_cache category::change_parent category::change_parent (public) category::change_parent->category_tree::flush_cache category_tree::copy category_tree::copy (public) category_tree::copy->category_tree::flush_cache category_tree::delete category_tree::delete (public) category_tree::delete->category_tree::flush_cache category_tree::import category_tree::import (public) category_tree::import->category_tree::flush_cache

Testcases:
category_tree_procs
Source code:
        set cur_level 1
        set stack [list]
        set invalid_p ""
        set tree [list]
        db_foreach flush_cache {
        select category_id, left_ind, right_ind,
               case when deprecated_p = 'f' then '' else '1' end as deprecated_p
        from categories
        where tree_id = :tree_id
        order by left_ind
        } {
            lappend tree [list $category_id [expr {"$invalid_p$deprecated_p" eq "" ? f : t}] $cur_level]
            if { $right_ind - $left_ind > 1} {
                incr cur_level 1
                set invalid_p "$invalid_p$deprecated_p"
                set stack [linsert $stack 0 [list $right_ind $invalid_p]]
            } else {
                incr right_ind 1
                while {$right_ind == [lindex $stack 0 0] && $cur_level > 0} {
                    incr cur_level -1
                    incr right_ind 1
                    set stack [lrange $stack 1 end]
                }
                set invalid_p [lindex $stack 0 1]
            }
        }
        if {[info exists category_id]} {
            nsv_set category_trees $tree_id $tree
        } else {
            nsv_set category_trees $tree_id ""
        }
XQL Not present:
Generic
PostgreSQL XQL file:
packages/categories/tcl/category-trees-procs-postgresql.xql

Oracle XQL file:
packages/categories/tcl/category-trees-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: