Niphlod
unread,Apr 11, 2013, 3:02:53 PM4/11/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-d...@googlegroups.com
This issue was kinda addressed before on the session.forget() part.
If you inspect the response.download() method, you'll see it uses session.forget already.
On the cache side, much depends on how the users handle the upload fields.
For apps where the uploads are something that gets rarely rendered by a browser (e.g. storing attachments), cache can't help that much.
If instead users use uploads just to store something than then gets shared a lot (e.g., pictures public on the home page, media on the wiki, etc) and without constraints, they should know better and use a folder that "falls" into the /static/ handling (so in production it can be offloaded).
In any case, decorating it with a @cache.client(public=False) is safe, cause it will send out headers that will prevent the client's browser to fetch that resource for the next 5 minutes (and that only client).
If permissions on those file change that fast, I assume a "dedicated" download replacement would be in the user app code: by the way the second a browser has fetched the resource I see no issues on send it the first time cached..... it's kinda a funny requirement to have a client download a file and then a few minutes back preventing him to download the same resource.
On the "let's move cache.client() to some other method, or use it by default", there's a problem: cache.client needs to execute the function completely before storing it into the cache, cause it needs to inspect response.status to know if cache headers can be set (yes, it can eventually suffer the "thundering herd" issue, but there's no other way to code it).
If you find a new name for that I have no absolute issue with that (I posted originally it as a separate module and I'm famous for having no actual sense for giving out names): just not consider it as a simple @cache replacement because the inner workings needed are different from a standard @cache decorator.