On Tue, Oct 20, 2009 at 8:16 AM, <torb...@gmx.de> wrote: > > my app is dynamically rendering images using cairo, which i write into > the response with: > > response.content_type="image/png" > surface.write_to_png( response ) > > i did not return anything, because it was working fine. > so when this was working, i wanted to have the images cached. > > @beaker_cache() did not work until i returned response.content > from my action.
The decorator caches the return value, so that makes sense. It doesn't look inside the response to see what you've written to it. > i also noticed that etag_cache() does not work when @beaker_cache is in > place. (clearly the function is never executed) > > it seems to be necessary to make etag_cache() a decorator too, where the > key may be a callable. I never could get etag_cache to work. > on irc it was pointed out, that most of this caching is not pylons > business. and i should be using a caching reverse proxy, and be all set. > what is the point in this caching infrastructure then anyways ? That's a rather one-size-fits-all statement. If you have a lot of pages to cache it would be worth setting up a proxy. In your case you're generating a lot of images, so a proxy might be worth it. But if you're just caching your sitemap and all-records page, a proxy would be overkill. Besides the cache decorator there's a 'cache' object, which can cache anything, not just pages. That's something a proxy can't do. > however some of these images should only be seen by the user who owns them. > so one solution would be to include a hash in the url. Ideally you'd have an auth umbrella above both the proxy and the Pylons application, but that means you have to use something other than Python for your auth. Perhaps an Apache module. By the way, the pylons-discuss list is the best place to ask usage questions. The pylons-devel list is for discussing changes to Pylons; details the entire userbase doesn't want to be bothered with. -- Mike Orr <sluggos...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en -~----------~----~----~----~------~----~------~--~---