c# - App Fabric Cache一天怎么清一次?

标签 c# appfabric appfabric-cache

我每天午夜寻找清除缓存的配置。

有可能吗?

或者我需要创建一个计划任务并在代码中清除?

最佳答案

// My cache, handle it the way you like
private static DataCache _cache;

public static void ClearCache()
{
    Parallel.ForEach(_cache.GetSystemRegions(), region =>
    {
         _cache.ClearRegion(region);
         var sysRegion = _cache.GetSystemRegionName(region);
         _cache.ClearRegion(sysRegion);
     });
 }

然后按照您自己定义的某个时间表在某个地方运行它。

我想在 Powershell 中也完全可以做同样的事情,但这是我已经使用了一段时间的解决方案。

关于c# - App Fabric Cache一天怎么清一次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21329729/

相关文章:

.net - AppFabric 与 System.Runtime.Caching

c# - Appfabric 缓存的执行速度比 SQL Server 2008 慢 4 倍??

c# - 确定在 .NET 中单击了哪个鼠标(多个鼠标设备)

c# - 为什么 ReactiveTest 不遵守此测试中的滴答计数

caching - Windows 上的 MS Velocity 与 Memcached 对比?

c# - 读取 AppFabric 内容会引发程序集异常

AppFabric 同步本地缓存

Appfabric 缓存 - 序列化

c# - 将泛型方法中的 T 参数转换为 DateTime

c# - 如何使用 .NET 3.0 中的插件框架?