0

I am using django cache with django-redis-cache as a backend.

with:

@cache_page(60*60*24)

decorator on views.

Now the issue I am facing is every get request is being stored with a different key in redis. I have to display the same page for any get parameters. Is there any way to force cache to ignore get parameters while serving and making the key.

ndpu
  • 22,225
  • 6
  • 54
  • 69
crazydiv
  • 812
  • 9
  • 30

1 Answers1

0

There's of course "a way" to compute a same cache key whatever the request's querystring, but it requires a bit of work - you'll have to rewrite your own cache_page implementation based on the low-level cache API (which is documented here https://docs.djangoproject.com/en/1.6/topics/cache/#the-low-level-cache-api). You may also read the source code for the CacheMiddleware (upon which cache_page is built).

Now I have to say I don't get the point of ignoring the querystring when generating the cache key for a page cache.

bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118
  • I actually am using something like a secret login based on GET parameters and using it to warmup the cache from a cron-type python script. (The page loads take around 25mins each). – crazydiv Jan 20 '14 at 13:00