Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 31 Jan 2003 16:16:24 -0000 1.32 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 13 Feb 2003 14:14:22 -0000 1.33 @@ -408,6 +408,9 @@ array set version [apm_read_package_info_file $spec_file_path] set package_key $version(package.key) + # Flush the installed_p cache + util_memoize_flush [list apm_package_installed_p_not_cached $package_key] + if { $copy_files_p } { if { [empty_string_p $install_path] } { set install_path [apm_workspace_install_dir]/$package_key Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -r1.38 -r1.39 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 9 Feb 2003 22:30:45 -0000 1.38 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 13 Feb 2003 14:14:22 -0000 1.39 @@ -654,11 +654,21 @@ package_key } { Returns 1 if there is an installed package version corresponding to the package_key, - 0 otherwise + 0 otherwise. Uses a cached value for performance. } { - return [db_string apm_package_installed_p {} -default 0] + if { [util_memoize_initialized_p] } { + return [util_memoize [list apm_package_installed_p_not_cached $package_key]] + } else { + return [apm_package_installed_p_not_cached $package_key] + } } +ad_proc -private apm_package_installed_p_not_cached { + package_key +} { + return [db_string apm_package_installed_p {} -default 0] +} + ad_proc -public apm_package_enabled_p { package_key } { Index: openacs-4/packages/acs-tcl/tcl/apm-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/tcl/apm-procs.xql 29 Jan 2003 15:41:25 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.xql 13 Feb 2003 14:14:22 -0000 1.12 @@ -92,7 +92,7 @@ - + select 1 from apm_package_versions where package_key = :package_key Index: openacs-4/packages/acs-tcl/tcl/memoize-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/memoize-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/memoize-procs.tcl 16 Sep 2002 22:30:46 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/memoize-procs.tcl 13 Feb 2003 14:14:22 -0000 1.5 @@ -136,6 +136,14 @@ } } +ad_proc -public util_memoize_initialized_p {} { + Return 1 if the util_memoize cache has been initialized + and is ready to be used and 0 otherwise. + + @author Peter Marklund +} { + return [ad_decode [catch {ns_cache set util_memoize __util_memoize_installed_p 1} error] 0 1 0] +} ad_proc -public util_memoize_flush_regexp { -log:boolean