2013-10-15 1 views
3

다른 응용 프로그램에서 HttpRuntime.Cache을 검색 할 수 있습니까? 나는 두 애플리케이션 데HttpRuntime.Cache의 범위

예 애플리케이션-A에 대한

, APP-B

앱-A에

제가

HttpRuntime.Cache.Insert(sCacheKey, sCacheValue, Nothing, Now.AddHours(CInt(System.Configuration.ConfigurationManager.AppSettings("CacheExpirationHours"))), TimeSpan.Zero) 

캐시에 값을 삽입하고 난 검색 할 아니다 App-B의 값

Dim strList As String 
strList = HttpRuntime.Cache.Get(sCacheKey) 

단순히 Nothing으로 반환됩니다. 내가 뭘 잘못하고 있니?

+2

HttpRuntime.Cache가 앱 도메인에 있으므로 다른 앱에서 HttpRuntime.Cache에 액세스 할 수 없습니다. 다른 앱에 액세스하려면 wcf, http 등을 통해 해당 캐시를 노출해야합니다. 또한 분산 캐시 사용을 고려하십시오. –

+1

Redis 또는 Memcached를 사용하는 것이 더 좋습니다. –

+1

다른 사람이 질문했습니다. http://stackoverflow.com/questions/1244105/sharing-an-httpruntime-cache-across-two-iis-applications – lex87

답변

6

HttpRuntime.Cache이 앱 도메인에 있으므로 다른 앱에서 액세스 할 수 없습니다. 다른 앱에 액세스하려면 wcf, web api 등을 통해 해당 캐시를 노출해야합니다. 또한 분산 캐시 사용을 고려하십시오.

+1

감사의 말씀을드립니다. – Jay