Hey all,
I'm trying to save on db queries in an online game I'm making, so I'm trying
to save as many things in memcached as possible, and invalidating whenever
the game state changes. So upon the first call, or after a game state
change, I pull in my game model instance, and all of the related models that
I'm going to need to manipulate or access later:
game = Game.objects.select_related('gamestatus', 'gameplayer', 'playerchat',
'playermove', 'playersquare').get(pk=game_id)
I then cache it (cache.set('game_%d' % game_id, game, 45)), and all is well.
Later, however, upon a new call to the server which accesses the cached
model, I've found that the related objects aren't cached (which makes sense,
due to possible cache management issues). However, assuming I've got
everything under control with my cache management, is there a way to force
the storage of all the related models in cache?
Game has nullable foreign key models, but none of the related tables do, and
there are nullable foreign keys that go out to the related tables, either.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---