In such case it would better to not cache entire method, but simply
the data - build the unique key per GET requests, check if the data is
already stored in cache, if so - use it, else - retrieve it from
database and store it in cache.
from django.core.cache import cache
def someview(req):
par = req.GET.get('somepar')
key = "someview:%s" % par
data = cache.get(key, None)
if not data:
# get data from database
# ...
cache.set(key, data)
# here normal usage of data
On 10-08-25 13:12, buddhasystem wrote:
Hello --
I think that might be the case... I do extract parameters from GET.
Am I out of luck?
Jirka Vejrazka wrote:
Is your AJAX query POST or GET query? Because as you may know, POST
queries
are not cached, GET queries are.
Also, GET requests are not cached in some cases (e.g. when GET
parameters are used) - it's really difficult to figure out what's
wrong without knowing specific details.
Cheers
Jirka
--
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en.
--
blog http://piotr.zalewa.info
jobs http://webdev.zalewa.info
twit http://twitter.com/zalun
face http://www.facebook.com/zaloon
--
You received this message because you are subscribed to the Google Groups "Django
users" 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/django-users?hl=en.