On 13 Sty, 07:54, hinnack <henrik.gens...@googlemail.com> wrote:
> Hi,
>
> I need to cache POST requests, too, on certain requests.
> The requests are not changing data, but imagine an XMLRPC
> service (that is based on POST requests only per spec anyway) uses
> functions, that always return the same like 2 + 2 SHOULD always
> return 4 :-) The site I have could use the caching-middleware, if it
> would support POST, as no request changes data.
>
> Now the whole caching mechanism of django only supports GET
> (as far as I know).
> Has someone tried on caching POST requests?
> Is someone else interested in caching POST requests? (is this more
> something for django core or should I write a decorator)
>

I would say that this is no different than caching GET requests.
If you take a look at django cache middlewares (django/middleware/
cache.py),
then you quickly notice that there are lines like:

        if not request.method in ('GET', 'HEAD') or request.GET:
            request._cache_update_cache = False
            return None # Don't bother checking the cache.

So you should quickly be able to just adapt that to you need by
including
POST request under some conditions.

--
Tomasz Zielinski
http://pyconsultant.eu
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to