Forum OpenACS Q&A: Re: adding header to resource files: cache-control max-age=NNNN

My case scenario is mainly with photo-album. So it would be a good idea to use a parameter per package.

I'll change it in my setup to use only inside photo-album. Thanks ;-)

Just to keep documented here. I'm using it now in photo album to serve images (6 months cache)

diff --git a/packages/photo-album/www/images/index.vuh b/packages/photo-album/www/images/index.vuh
index ce37de7..2a567bd 100644
--- a/packages/photo-album/www/images/index.vuh
+++ b/packages/photo-album/www/images/index.vuh
@@ -18,6 +18,10 @@ if {[parameter::get -parameter CheckPermissionOnImageServeP] == "t"} {
permission::require_permission -object_id $image_id -privilege "read"
}

+# Based on http://www.openacs.org/forums/message-view?message_id=4231862
+# Six months expire
+ ns_setexpires [expr {60*60*24*30*6}]
+
if {[catch {cr_write_content -revision_id $image_id} errMsg]} {
if {$::errorCode eq "NOT_FOUND"} {
ns_returnnotfound