It'd be cool to extend this to support ETags and expiry include it in web.py.

On Sat, Oct 18, 2008 at 11:20 PM, Justin Davis <[EMAIL PROTECTED]> wrote:
>
> Agreed, I do something similar:
>
> CACHE = {}
> def cachepage():
>    def decorator(func):
>        def proxyfunc(self, *args, **kw):
>            url = web.ctx.get('fullpath')
>            if url not in CACHE:
>                CACHE[url] = func(self, *args, **kw)
>            return CACHE[url]
>        return proxyfunc
>    return decorator
>
> You can use this to decorate your GET methods.  For POST methods, you
> can just "del CACHE[web.ctx.fullpath]" or wherever that page may
> change.
>
> On Oct 18, 6:39 pm, "Aaron Swartz" <[EMAIL PROTECTED]> wrote:
>> Nobody has written code that does just this AFAIK, but it shouldn't be
>> too hard. You have a dict-like object that stores the cache, then a
>> decorator that works like memoize but deletes the cache entry if
>> forceupdate is sent (I'd suggest making it a POST rather than a GET,
>> though, so that search engines and so on don't accidentally empty your
>> cache).
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to