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?
Django could cache such list, you need to check
cache.set('foo', 'bar')thengetto ensure the cache workssetsucceedsfoobaris too big to fit in the cache