.net - dotnet System.Web.Caching.Cache vs System.Runtime.Caching.MemoryCache -


i've got class needs store data in cache. used in asp.net application used system.web.caching.cache.

now need use in windows service. now, understand it, should not use asp.net cache in not asp.net application, looking memorycache.

the problem not compatible, either change use memorycache in asp.net application, or need create adapter ensure 2 cache implementations have same interface (maybe derive objectcache , use asp.net cache internally?)

what implications of using memorycache in asp.net?

nadav

i go second option , refactor things little bit. create interface , 2 providers (which adapters):

public interface icachingprovider {     void additem(string key, object value);     object getitem(string key); }  public aspnetcacheprovider : icachingprovider {     // adapt system.web.caching.cache match interface }  public memorycacheprovider : icachingprovider {     // adapt system.runtime.caching.memorycache match interface } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -