I have been assigned a new project. In this django project the previous developer uses django.core.cache module a lot.
I decided to keep it like this.
My question is this. Can I make a unique string out of the request object that would let me know if the request object is the same as before?
Request comes with a set of 15 parameters (even more) and it is hard to choose one or some of them to create a key. It has to be all, because different combinations lead to different results.
This is the code I want to change (some code left out for brevity):
@login_required
def compare(request, username):
cache_key = 'key__%d' % (request.GET.to_unique_id_or_similar())
cache_value = cache.get(cache_key)
if cache_value is not None:
return cache_value
request.GETdictionary object will return the values always in the same way?