Skip to content

[HybridCache] [Behavior Proposal] Allow Options from GetOrCreateAsync to not set "null" in cache #7664

Description

@tebeco

Hello,

As far as I've tested, it seems that when a CACHE MISS happen the "Create Factory" is called.
When this happen and the factory also returns null (like for example db.FirstOrDefault(id), then the null value is also propagated to the cache.

This create quite some noise for cached object lifetime managment.

It would be nice to be able to pass a value inside the already existing Options parameter of the GetOrCreateAsync that tells the factory:
"If the factory returns null, don't bother settings null in cache"

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