CacheAspect requires to specify <add key="CacheAspect.CacheType"> in AppSettings

Aug 12, 2012 at 12:56 AM

 

 The CacheAspect worked correctly in tests, but I wasn't be able to make cache working in real asp.net application. It took me a while to recognize, that by default cache is disabled by assigning NoCache as a type. 
I haven't noticed any info in documentation/blogs, that CacheAspect depends on AppSetting entries, in particular 
    <add key="CacheAspect.CacheType" value="CacheAspect.InProcessMemoryCache"/>
    <add key="CacheAspect.DiskPath" value=""/>   
     <add key="CacheAspect.TimeToLive" value="7:0:0:0"/>
The current default, if CacheAspect.CacheType is not defined , is NoCache, which is not convenient to users. I've changed default to CacheAspect.InProcessMemoryCache and added trace logging in case of exception when parsing AppSettings["CacheAspect.CacheType"])                                                                                                    
Also, have you considered to use HttpRuntime.Cache as underline provider for Cache? It should be native choice for ASP.Net application
Coordinator
Aug 19, 2012 at 3:58 PM

Hi,

Thanks a lot for the feedback.

If you want to not use app settings, you can set the cache type in code like this:

 

CacheService.Cache = new InProcessMemoryCache();

I will put better defaults and investigating ASP.net Cache on my todo list for this project.