Skip to content

Store._loadedItem returns stale Item from Store.objectCache #92

@ldanielburr

Description

@ldanielburr

When a Store instance in process A has an Item instance cached in its objectCache, changes to the underlying database row in process B will not be reflected unless the cache entry expires. In some cases, this may never happen, resulting in the stale Item being cached until the Store instance in process A is closed/reopened, or process A is restarted, etc.

Based on the comment on line 1750, "# XXX do checks on consistency between attrs and DB object, maybe?", it seems possible to compare the values returned from the database with the attributes of the cached Item instance, and if they do not match, update the Item instance in-place.

Alternately, we could just uncache the Item instance and raise KeyError, which would cause a new Item instance to be created via the call to existingInStore. I think I prefer the "update in-place" solution myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions