Skip to content

Allow null values pattern #301

@fabionaspolini

Description

@fabionaspolini

Hi,

Sometimes the null value is a significative value and CacheManaget library does not support this case.
I would like manager this behavior.
My suggestion is enable/disable this feature by ICacheManager.Configuration.

Exemple:

cacheManager = CacheFactory.Build("name", settings => settings.WithMicrosoftMemoryCacheHandle("handle"));

// New property... default its false for compatibility
cacheManager.Configuration.AllowNull = true;

In my case, I read params from database and store in memory cache by X minute, but if value does not exists in database, I would like stored this key in memory cache with null value, and reduced sql overhead to try to obtain inexistent value.
This behavior is planned and supported by Microsoft IMemoryCache for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions