我可以存储.NET Cache密钥的限制是什么?

时间:2022-04-28 03:50:07

I want to store up to 500 cache keys (one per user) using System.Web.Caching. The cached value wouldn't exceed an 11 character string (ie. 'Los Angeles')

我想使用System.Web.Caching存储多达500个缓存键(每个用户一个)。缓存的值不会超过11个字符的字符串(即'洛杉矶')

string key = "Location" + userName;
string location = GetUsersLocation();
Cache.Insert(key, location);

Does this surpass the limitations of .NET caching or would this technique go against best practices?

这是否超越了.NET缓存的限制,或者这种技术是否会违反最佳实践?

1 个解决方案

#1


0  

the cache limit depends on the available system memory and on your worker process if running in 64 bits or 32 bits.
you will be able to use much more memory if running in 64 bits.
ASP.NET Cache will engage garbage collections and starts dropping cache when a w3wp process memory usage is greater than or equal to about 80% of the worker process memory limit.The worker process memory limit can be set in machine.config for aspnet_wp.exe, or in the IIS metabase for w3wp.exe.

如果以64位或32位运行,则缓存限制取决于可用的系统内存和工作进程。如果以64位运行,您将能够使用更多内存。当w3wp进程内存使用量大于或等于工作进程内存限制的大约80%时,ASP.NET Cache将参与垃圾收集并开始删除缓存。可以在machine.config中为aspnet_wp.exe设置工作进程内存限制,或在w3wp.exe的IIS元数据库中。

#1


0  

the cache limit depends on the available system memory and on your worker process if running in 64 bits or 32 bits.
you will be able to use much more memory if running in 64 bits.
ASP.NET Cache will engage garbage collections and starts dropping cache when a w3wp process memory usage is greater than or equal to about 80% of the worker process memory limit.The worker process memory limit can be set in machine.config for aspnet_wp.exe, or in the IIS metabase for w3wp.exe.

如果以64位或32位运行,则缓存限制取决于可用的系统内存和工作进程。如果以64位运行,您将能够使用更多内存。当w3wp进程内存使用量大于或等于工作进程内存限制的大约80%时,ASP.NET Cache将参与垃圾收集并开始删除缓存。可以在machine.config中为aspnet_wp.exe设置工作进程内存限制,或在w3wp.exe的IIS元数据库中。