简体   繁体   中英

Share cache among the projects in one solution

I have an solution with 4 projects and I need to share cache among the 4 projects. is it possible in .net?

In projet A

   public static CacheManagerClass{

    public static T GetCache<T>(string key) where T : class
    {
     object cachedObject = HttpRuntime.Cache.Get(key);
    return cachedObject ;
    }
    }

this is a sample of method i used to retrieve the cache object. and the cache is created by an MVC application.I need to access the same cache using a wcf

在其他3个项目引用的项目中创建缓存并使用它?

If i understand correctly, you are trying to reference the cache class from 3 (or 4) different executables. This cannot be done because each process loads it own instance of the cache class from the DLL.

You probably need to create some cache service (using WCF for example) which runs on another process (or on one of the existing processes) in order to manage caching for the multiple processes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM