You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Line 244 of base.py specifically finds foreign keys and invalidates those as well.
def _cache_keys(self):
"""Return the cache key for self plus all related foreign keys."""
fks = dict((f, getattr(self, f.attname)) for f in self._meta.fields
if isinstance(f, models.ForeignKey))
keys = [fk.rel.to._cache_key(val, self._state.db) for fk, val in fks.items()
if val is not None and hasattr(fk.rel.to, '_cache_key')]
return (self.cache_key,) + tuple(keys)
What is the reasoning behind including foreign keys in the invalidation. In our experience, the foreign keys are rarely if ever updated when the related object is updated and so invalidation of the related object seems unnecessary. I am curious, however, if there is a reason that I am not considering.
Thanks.
The text was updated successfully, but these errors were encountered:
I would like to have an explanation too,
my suspicion is that that this invalidation is need when explicit joins are needed.
Since I use a non relational database, I would like to know if this operation is needed or not.
Line 244 of base.py specifically finds foreign keys and invalidates those as well.
What is the reasoning behind including foreign keys in the invalidation. In our experience, the foreign keys are rarely if ever updated when the related object is updated and so invalidation of the related object seems unnecessary. I am curious, however, if there is a reason that I am not considering.
Thanks.
The text was updated successfully, but these errors were encountered: