Store into cache using instance.id instead of requested id.

This helps ensure that the keys of the cache are the true and correct
data type and not just whatever the user provided. SQLite coerces
strings and ints.
This commit is contained in:
voussoir 2022-03-10 11:24:52 -08:00
parent c7f4d1dbf9
commit d17a79c128
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -455,7 +455,7 @@ class DatabaseWithCaching(Database, metaclass=abc.ABCMeta):
instance = object_class(self, object_row)
if object_cache is not None:
object_cache[object_id] = instance
object_cache[instance.id] = instance
return instance