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 -N -r1.126.2.18 -r1.126.2.19 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 15 Nov 2021 17:28:06 -0000 1.126.2.18 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 18 Nov 2021 19:13:46 -0000 1.126.2.19 @@ -1015,7 +1015,9 @@ # Run install.xml only for new installs # ns_log notice "===== RUN /packages/$package_key/install.xml" - apm::process_install_xml -install_from_repository=$install_from_repository_p /packages/$package_key/install.xml "" + apm::process_install_xml \ + -install_from_repository=$install_from_repository_p \ + /packages/$package_key/install.xml "" } } else { @@ -1025,15 +1027,15 @@ } # Flush the installed_p cache - util_memoize_flush [list apm_package_installed_p_not_cached $package_key] + acs::misc_cache flush apm_package_installed-$package_key return $version_id } ad_proc apm_unregister_disinherited_params { package_key dependency_id } { Remove parameters for package_key that have been disinherited (i.e., the - dependency that caused them to be inherited have been removed). Called only + dependency that caused them to be inherited have been removed). Called only by the APM and keep it that way, please. } { @@ -1076,7 +1078,9 @@ {-callback apm_dummy_callback} {-array:required} {-version_id ""} - package_key version_name version_uri summary description description_format vendor vendor_uri auto_mount {release_date ""} + package_key version_name version_uri summary description + description_format vendor vendor_uri auto_mount + {release_date ""} } { Installs a version of a package. @@ -1236,8 +1240,7 @@ } # Flush the installed_p cache - util_memoize_flush [list apm_package_installed_p_not_cached $package_key] - + acs::misc_cache flush apm_package_installed-$package_key apm_callback_and_log $callback "

Done." } @@ -1538,6 +1541,7 @@ @param version_id The id of the version to be enabled. } { db_exec_plsql apm_package_version_enable {} + acs::misc_cache flush apm_package_enabled-[apm_package_key_from_version_id $version_id] apm_callback_and_log $callback "

Package enabled." } @@ -1548,6 +1552,7 @@ @param version_id The id of the version to be disabled. } { db_exec_plsql apm_package_version_disable {} + acs::misc_cache flush apm_package_enabled-[apm_package_key_from_version_id $version_id] apm_callback_and_log $callback "

Package disabled." } 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 -N -r1.114.2.34 -r1.114.2.35 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 2 Sep 2021 18:35:54 -0000 1.114.2.34 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 18 Nov 2021 19:13:47 -0000 1.114.2.35 @@ -825,7 +825,7 @@ # set before [list epoch [ns_ictl epoch] size [string length [ns_ictl get]]] ns_log notice "### blueprint_reloading: before $before cmds:\n[join $cmds \;\n]" - + ns_eval [join $cmds \;] # # The current thread has still the old blueprint. If we @@ -1022,31 +1022,40 @@ Returns 1 if there is an installed package version corresponding to the package_key, 0 otherwise. Uses a cached value for performance. } { - if { [util_memoize_initialized_p] } { - return [util_memoize [list apm_package_installed_p_not_cached $package_key]] + set sql { + select 1 from apm_package_versions + where package_key = :package_key + and installed_p = 't' + } + if {[info commands ::acs::misc_cache] ne ""} { + return [acs::misc_cache eval apm_package_installed-$package_key { + db_0or1row apm_package_installed_p $sql + }] } else { - return [apm_package_installed_p_not_cached $package_key] + ns_log warning "apm_package_installed_p $package_key needs direct query" + return [db_0or1row apm_package_installed_p $sql] } } -ad_proc -private apm_package_installed_p_not_cached { +ad_proc -public -debug apm_package_enabled_p { package_key } { - return [db_0or1row apm_package_installed_p { - select 1 from dual where exists - (select 1 from apm_package_versions - where package_key = :package_key - and installed_p) - }] -} - -ad_proc -public apm_package_enabled_p { - package_key -} { Returns 1 if there is an enabled package version corresponding to the package_key and 0 otherwise. } { - return [db_string apm_package_enabled_p {} -default 0] + set sql { + select 1 from apm_package_versions + where package_key = :package_key + and enabled_p = 't' + } + if {[info commands ::acs::misc_cache] ne ""} { + return [acs::misc_cache eval apm_package_enabled-$package_key { + db_0or1row apm_package_enabled_p $sql + }] + } else { + ns_log warning "apm_package_enabled_p $package_key needs direct query" + return [db_0or1row apm_package_enabled_p $sql] + } } ad_proc -public apm_enabled_packages {} { @@ -1332,7 +1341,7 @@ return $result } -ad_proc -public apm_flush_package_id_cache {package_key} { +ad_proc -public apm_flush_package_id_cache {package_key} { Flush the package id cache for this package at least in the current thread. TODO: should be refactored together with the 2level cache (per thread and util_memoize). 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 -N -r1.30.2.3 -r1.30.2.4 --- openacs-4/packages/acs-tcl/tcl/apm-procs.xql 17 Oct 2020 16:47:14 -0000 1.30.2.3 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.xql 18 Nov 2021 19:13:47 -0000 1.30.2.4 @@ -96,14 +96,6 @@ - - - select 1 from apm_package_versions - where package_key = :package_key - and enabled_p = 't' - - - select 1 from apm_package_versions