Reputation: 10511
It's possible to cache list with different types of objects in django? When i'm trying to do this, django always return None to me.
Check this code:
foo = Foo.objects.all()[:10]
bar = Bar.objects.all()[:10]
foobar = list(foo) + list(bar)
cache.set('foobar', foobar)
cache.get('foobar') # None
If this is normal behaviour, is there some workarounds?
Upvotes: 0
Views: 59
Reputation: 23871
Django could cache such list, you need to check
cache.set('foo', 'bar')
then get
to ensure the cache worksset
succeedsfoobar
is too big to fit in the cacheUpvotes: 2