acs::SiteNodeUrlspaceCache method get_node_id (public)
<instance of acs::SiteNodeUrlspaceCache> get_node_id -url url
Defined in packages/acs-tcl/tcl/site-nodes-procs.tcl
Get node_id for the provided URL. We have to determine the partial URL for determining the site node.
- Switches:
- -url (required)
- Returns:
- node_id (integer)
- Testcases:
- No testcase defined.
Source code: # # This is the main interface of the # SiteNodeUrlspaceCache to provide a first-level # cache. # # Try per-request caching # if {[dict exists ${:static_site_nodes} $url]} { set key :node_id($url) } else { set key ::__node_id($url) } if {[info exists $key]} { #ns_log notice "==== returning cached value [set $key]" return [set $key] } # # Try to get value from urlspace # set ID [ns_urlspace get -id $::acs::siteNodesID -key sitenode $url] if {$ID eq ""} { # # Get value the classical way, caching potentially # the full url path in the site_nodes_id_cache. # set ID [next] #ns_log notice "--- get_node_id from site_nodes_id_cache <$url> -> <$ID>" if {$ID ne ""} { # # We got a valid ID. If we would add blindly a # node_id for the returned URL (e.g. for "/*") # and some other subnode is not jet resolved, # we would obtain later the node_id of the # parent_node although there is a subnode. # # We could address this by e.g. pre-caching # all "inner nodes" or similar, but this # requires a deeper analysis of larger sites. # # In earlier versions, we had here # ... {[site_node::get_children -node_id $ID] eq ""} ... # but on site_node trees with huge number of entries, # this is a waste. # if {![:has_children -node_id $ID]} { # # We are on a leaf-node of the site node # tree. Get the shortened url and save it # in the urlspace. # set short_url [site_node::get_url -node_id $ID] set cmd [list ns_urlspace set -id $::acs::siteNodesID -key sitenode $short_url* $ID] #ns_log notice "--- get_node_id save in urlspace <$cmd> -> <$ID>" {*}$cmd #ns_log notice "---\n[join [ns_urlspace list -id $::acs::siteNodesID] \n]" } return [set $key $ID] } } return $IDGeneric 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