Thank you so very much. It works like a clock! I use urlencode to to convert the complete URL hash into a key, that's just logical. I wrap set and get. A total of 10 lines of extra code isn't bad, of course the simple use of decorator would be even nicer!
Piotr Zalewa-2 wrote: > > 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 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. >>> >>> >>> > > > -- > 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 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. > > > -- View this message in context: http://old.nabble.com/Caching-JSON-in-Django-tp29526535p29535253.html Sent from the django-users mailing list archive at Nabble.com. -- 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.