asp.net-corehybridcache

What's the default value for LocalCacheExpiration and Expiration in HybridCache


What's the default value for LocalCacheExpiration and Expiration in HybridCache.

You can set these values in HybridCacheOptions.HybridCacheEntryOptions but the source doesn't mention the default value, and I wasn't able to find the defaults in the docs either.


Solution

  • It seems the default is 5 minutes:

    internal sealed partial class DefaultHybridCache : HybridCache
    {
        internal const int DefaultExpirationMinutes = 5;
    

    Source: https://github.com/dotnet/extensions/blob/eac5c605634171d870d8454cc82ff7cf4780a8f4/src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.cs#L27