【发布时间】:2013-10-26 22:34:44
【问题描述】:
我找不到关于如何在 winforms c# 中完成简单缓存的体面示例 这就是我想出的,但我得到了例外。
// 这一行已经出现异常 ICacheManager productsCache = CacheFactory.GetCacheManager("MyCacheManager");
例外是: 附加信息:无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common, Version=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 倍的时间
【问题讨论】: