there's a new @cache.client decorator to set expire headers in an easy way
....
as soon as the book gets updated the docs will be here
http://web2py.com/books/default/chapter/29/04#cache
On Saturday, April 6, 2013 11:58:17 AM UTC+2, BlueShadow wrote:
>
> There supposedly is a way the fast download function(web2pyslices)
> def fast_download():
> # very basic security (only allow fast_download on
> your_table.upload_field):
> if not request.args(0).startswith("db.your_table.your_field"):
> return download()
> # remove/add headers that prevent/favors client-side caching
> #7days
> response.headers['Cache-Control'] = "max-age=604800"
> del response.headers['Pragma']
> del response.headers['Expires']
> filename = os.path.join(request.folder,'uploads',request.args(0))
> # send last modified date/time so client browser can enable
> client-side caching
> response.headers['Last-Modified'] = time.strftime("%a, %d %b %Y
> %H:%M:%S +0000", time.localtime(os.path.getmtime(filename)))
>
> return response.stream(open(filename,'rb'))
>
> this is the version I'm experimenting with. the original had a del Cache
> Control instead of the max age. but google pagespeed still tells me that no
> expiration date is set.
>
>
> On Saturday, April 6, 2013 4:42:45 AM UTC+2, Tito Garrido wrote:
>>
>> Hi!
>>
>> I was running page speed on my website and all image files from the
>> database (upload folder) are not cached...
>> Is there a way to enable cache for them?
>>
>> Thanks!
>>
>> Tito
>>
>> --
>>
>> Linux User #387870
>> .........____
>> .... _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:_______
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.