I'm using memcached as a cache backend in Django. The cache is not working for a particular view. Below is the logic of the caching in the view.
>>> genre = Genre.objects.get(id=1)
>>> genre_song_list = Song.objects.filter(genres=genre, duplicate=False).order_by('-votes', '-release_date')
>>> print genre_song_list
[<Song: Waiting>, <Song: Till The Sky Falls Down>, <Song: Better Half Of Me>, <Song: World Falls Apart>, <Song: Jar Of Hearts>, <Song: Man On The Run>, <Song: Like Spinning Plates>, <Song: Go It Alone>, <Song: Nini>, <Song: So Get Up>, <Song: Wings>, <Song: Mysteries Unfold>, <Song: Sacramentum>, <Song: Violetta>, <Song: Love Again>, <Song: Breathe>, <Song: Game Over>, <Song: The Expedition (A State Of Trance 600 Anthem)>, <Song: When You Were Around>, <Song: Mustang>, '...(remaining elements truncated)...']
>>> cache.set('trance_song_list', genre_song_list, 86400)
>>> cache.get('trance_song_list')
The cache is working fine otherwise
>>> cache.set('a', 'abc')
>>> cache.get('a')
'abc'
Following are my cache settings
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'TIMEOUT': 86400,
}
}
Can't seem to figure out what is the problem here. Any suggestions?