Hey everyone, I'm having problems with caching a queryset and storing the results of the query in the cache so the queries don't run when the page loads. I am caching and pickling the queryset, however I keep just storing the query but not the results of the query.
I've read through the docs several times and still am not getting what I need. I am caching and pickling a query set via a management command which should be evaluated by django so the query is not executed on page load, it should use cached results at the time of the cache object creation. But the debug toolbar is showing that the queries are still running when the page loads. So I'm assuming I'm just caching the query and not the results. Below is my code, any help would be great, I've been stuck on this for a few days now... thanks.
management command to generate the cache key, value:
images_query = ImageAssociations.objects.filter(place_id = place_id).order_by(-image_score')[:10]
images = pickle.dumps(images_query)
cache.set('images', images, timeout=9999)
views.py
images_cache = cache.get('images')
images = pickle.loads(images_cache)
args = {}
args['images'] = images
return render_to_response('place.html', args)