Försöker använda Microsoft.ApplicationBlocks.Cache Men när jag försöker hämta ett objekt som jag lagt på chachen så finns det inte.
Instantierar så här
CacheManager cm = CacheManager.GetCacheManager();
Lägger till
cm.Add(objType.ToString() + keyValue.ToString(),result);
Hämtar
object result = cm.GetData(objType.ToString() + keyValue.ToString());
web.config
<configSections>
<section name="CacheManagerSettings" type="Microsoft.ApplicationBlocks.Cache.CacheConfigurationHandler,Microsoft.ApplicationBlocks.Cache" />
</configSections>
<CacheManagerSettings>
<DataProtectionInfo AssemblyName="Microsoft.ApplicationBlocks.Cache"
ClassName="Microsoft.ApplicationBlocks.Cache.DataProtection.DefaultDataProtection"
ValidationKey="Oci44OQ9C3xAdQ3/BMHpksPfzeTezLkXen/ahQ8T7nVk/KMgAFnssQJr00KUNhRso+MpLVwAinGep6i14X9M+A=="
Validation="SHA1"/>
<StorageInfo AssemblyName="Microsoft.ApplicationBlocks.Cache"
ClassName="Microsoft.ApplicationBlocks.Cache.Storages.SingletonCacheStorage"
Mode="InProc"
Validated="true"
Encrypted="true"/>
<!-- SCAVENGING SETTINGS
Use the ScavengingAlgorithm to set a class that will be executed when
scavenging is performed.
-->
<ScavengingInfo AssemblyName="Microsoft.ApplicationBlocks.Cache"
ClassName="Microsoft.ApplicationBlocks.Cache.Scavenging.LruScavenging"
MemoryPollingPeriod="60"
UtilizationForScavenging="80"
MaximumSize="5"/>
<!-- EXPIRATION SETTINGS
Use the ExpirationCheckInterval to change the interval to check for
cache items expiration. The value attribute is represented in seconds.
<ExpirationInfo Interval="1" />-->
<ExpirationInfo Interval="120" />
</CacheManagerSettings>
</configSections>
Jag har fått för mig att det ska funka som ett singelton-objekt om man konfar så. Är det fel?
I så fall ska ju cachen skapas vid första anropet och senad returneras vid följande anrop.
Finns det något bra sätt att kolla alla objekt i chachen?