Skip to content

cache update: don't replace model. replace resource #36

@engenb

Description

@engenb

when the basic cache updates a model, it's just overriding any previous model in the cache with that id. this is bad. models may be updated from various apis at various times during a session's lifetime. doing so will mess up any model pointers that haven been returned from the session.

i.e. the reference that was returned from the session is no longer the cached model because it was overwritten by some other caching operation.

instead, the cache should check for the existence of a model and replace its Resource with the one fetched from the server.

this would require a new method be woven into the Model to refresh all the attribute Property values from the newly set Resource.

model.UpdateResource(IResourceIdentifier resource)
{
  foreach Property marked as [Property], refresh value from session
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions