Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs.tcl,v diff -u -r1.84 -r1.85 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 12 Apr 2013 14:16:36 -0000 1.84 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 24 May 2013 18:41:50 -0000 1.85 @@ -3470,8 +3470,17 @@ @author Don Baccus (dhogasa@pacifier.com) } { - foreach key [ns_cache names $cache_pool $cache_key_pattern] { - ns_cache flush $cache_pool $key + # + # If the key pattern has meta characters, iterate over the entries. + # Otherwise, make a direct lookup, without retrieven the all keys + # from the cache, which can cause large mutex lock times. + # + if {[regexp {[*\]\[]} $cache_key_pattern]} { + foreach key [ns_cache names $cache_pool $cache_key_pattern] { + ns_cache flush $cache_pool $key + } + } else { + ns_cache flush $cache_pool $cache_key_pattern } }