Skip to content

Uncommitted data can be written to cache when mixing cached and non-cached models #18

@betamatt

Description

@betamatt

The model that begins a transaction determines whether cache-safe transaction semantics are used. If safe and unsafe transactions are nested, data can end up committed to cache even when the database transaction rolls back.

It's important to continue supporting use cases where only some models are cached but I feel a refactor is needed to move transaction wrappers to the AR::Base level. If model caching is used at all then all transactions should be wrapped with cache-safe semantics, not just models marked is_cached. This change implies that a cache repository needs to be configured at the AR::Base level as well, and not just on individual models, although it can be overridden on a per-model basis.

I'm opening this issue for discussion prior to putting together a patch.

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