Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Memcached API 有一个 Touch() 方法,用于更新给定键的过期策略。如何使用 .Net ObjectCache 类最好地完成此任务?
我能看到的最好的方法是删除对象并重新添加一个新的过期时间,但显然这是次优性能。
不幸的是,无法重置缓存项持续时间。
但是,因为它是内存缓存(不像 memcached 那样分布式),所以获取和重新添加速度很快,就像传递引用一样。
另一种选择是对缓存项使用 SlidingExpiration。