相关疑难解决方法(0)

MemoryCache 的大小设置是什么意思?

在控制器类中,我有

using Microsoft.Extensions.Caching.Memory;
private IMemoryCache _cache;
private readonly MemoryCacheEntryOptions CacheEntryOptions = new MemoryCacheEntryOptions()
    .SetSize(1)
    // Keep in cache for this time
    .SetAbsoluteExpiration(TimeSpan.FromSeconds(CacheExpiryInSeconds));
Run Code Online (Sandbox Code Playgroud)

在 Startup.cs 中,我有

public class MyMemoryCache
    {
        public MemoryCache Cache { get; set; }
        public MyMemoryCache()
        {
            Cache = new MemoryCache(new MemoryCacheOptions
            {
                SizeLimit = 1024,
            });
        }
    }
Run Code Online (Sandbox Code Playgroud)

这些不同的尺寸设置是什么意思?

这是 .NET Core 2.1。

c# caching memorycache asp.net-core-2.1

14
推荐指数
1
解决办法
5831
查看次数

标签 统计

asp.net-core-2.1 ×1

c# ×1

caching ×1

memorycache ×1