Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.140.2.7 -r1.140.2.8 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 8 Oct 2015 19:21:59 -0000 1.140.2.7 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 10 Oct 2015 17:57:53 -0000 1.140.2.8 @@ -4652,11 +4652,61 @@ } ad_proc ad_tmpdir {} { - conveniece function to return the tmp directory + Convenience function to return the tmp directory } { return [ns_config ns/parameters tmpdir] } +if { [apm_first_time_loading_p] } { + nsv_set ad_html_procs mutex [ns_mutex create] +} + +# +# Experimental disk-cache, to test whether this can speed up openacs forums threads +# Documentation follows +# +ad_proc -public util::disk_cache_flush { + -key:required + -id:required +} { +} { + set dir [ad_tmpdir]/$key + foreach file [flib -nocomplain $dir/$id-*] { + file delete $file + ns_log notice "FLUSH file delete $file" + } +} + +ad_proc -public util::disk_cache_eval { + -call:required + -key:required + -id:required +} { +} { + set cache [::parameter::get_from_package_key \ + -package_key acs-tcl \ + -parameter DiskCache \ + -default 1] + if {$cache} { + set hash [ns_sha1 $call] + set dir [ad_tmpdir]/$key + set file_mame $dir/$id-$hash + ns_mutex eval [nsv_get ad_html_procs mutex] { + if {![file isdirectory $dir]} {file mkdir $dir} + if {[file readable $file_mame]} { + set result [template::util::read_file $file_mame] + } else { + set result [{*}$call] + template::util::write_file $file_mame $result + } + } + } else { + set result [{*}$call] + } + return $result +} + + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/forums/lib/message/row.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.tcl,v diff -u -r1.12.2.1 -r1.12.2.2 --- openacs-4/packages/forums/lib/message/row.tcl 12 Sep 2015 11:06:24 -0000 1.12.2.1 +++ openacs-4/packages/forums/lib/message/row.tcl 10 Oct 2015 17:57:53 -0000 1.12.2.2 @@ -20,8 +20,13 @@ set presentation_type "" } +#set message(content) [::util::disk_cache_eval \ + -call [list ad_html_text_convert -from $message(format) -to text/html -- $message(content)] \ + -key fragments \ + -id $message(message_id)] set message(content) [ad_html_text_convert -from $message(format) -to text/html -- $message(content)] + if {$useScreenNameP} { acs_user::get -user_id $viewer_id -array user_info set message(screen_name) $user_info(screen_name)