我找不到如何在 winforms c# 中完成简单缓存的体面示例,这是我想出的,但我遇到了例外。
// 这行已经得到一个异常 ICacheManager productsCache = CacheFactory.GetCacheManager("MyCacheManager");
例外情况是:附加信息:无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common,版本=5.0.414.0,
我认为我无法正确配置的 app.config 是:
<configuration>
<configSections>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<cachingConfiguration defaultCacheManager="MyCacheManager">
<cacheManagers>
<add name="MyCacheManager" type="Microsoft.Practices.EnterpriseLibrary.Caching, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="NullBackingStore" />
</cacheManagers>
<backingStores>
<add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="NullBackingStore" />
</backingStores>
</cachingConfiguration>
</configuration>
我使用 entlib 配置创建 app.config 我不断收到异常。有我可以使用的例子吗?(比 2007 年的示例更新)
10 倍的时间