ad_parameter_cache (public)
ad_parameter_cache [ -set set ] [ -delete ] [ -global ] key \ parameter_name
Defined in packages/acs-tcl/tcl/defs-procs.tcl
Manages the cache for ad_parameter.
- Switches:
- -set (optional)
- Use this flag to indicate a value to set in the cache.
- -delete (optional, boolean)
- Delete the value from the cache
- -global (optional, boolean)
- If true, global param, false, instance param
- Parameters:
- key (required)
- Specifies the key for the cache'd parameter, either the package instance id (instance parameter) or package key (global parameter).
- parameter_name (required)
- Specifies the parameter name that is being cached.
- Returns:
- The cached value.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- auth_password_change, auth_use_email_for_login_p, auth_email_on_password_change, parameter__check_procs
Source code: if {$delete_p} { acs::clusterwide ad_parameter_cache_flush_dict $key $parameter_name acs::per_request_cache flush -pattern acs-tcl.ad_param-$key return } if {[info exists set]} { nsv_dict set ad_param $key $parameter_name $set acs::per_request_cache flush -pattern acs-tcl.ad_param-$key return $set } # # Keep the parameter dict in a per-request cache to reduce # potentially high number of nsv locks, when parameters of a # package are queried a high number of times per request # (without this we see on some sites > 100 locks on this nsv # per request). # set dict [::acs::per_request_cache eval -no_cache "" -key acs-tcl.ad_param-$key { if {[nsv_get ad_param $key result]} { #ns_log notice "ad_parameter_cache $key $parameter_name not cached" set result } else { set result "" } }] if {[dict exists $dict $parameter_name]} { #ns_log notice "ad_parameter_cache $key $parameter_name get from dict" return [dict get $dict $parameter_name] } if { $global_p } { set value [db_string select_global_parameter_value { select apm_parameter_values.attr_value from apm_parameters, apm_parameter_values where apm_parameter_values.package_id is null and apm_parameter_values.parameter_id = apm_parameters.parameter_id and apm_parameters.parameter_name = :parameter_name and apm_parameters.package_key = :key } -default ""] } else { set value [db_string select_instance_parameter_value { select apm_parameter_values.attr_value from apm_parameters, apm_parameter_values where apm_parameter_values.package_id = :key and apm_parameter_values.parameter_id = apm_parameters.parameter_id and apm_parameters.parameter_name = :parameter_name } -default ""] } nsv_dict set ad_param $key $parameter_name $value return $valueXQL Not present: Generic, PostgreSQL, Oracle