Scope of HttpRuntime.Cache
Asked Answered
S

1

5

Is it possible to retrieve HttpRuntime.Cache from another application?

i am having two applications ,

for example App-A, App-B

in App-A i am inserting values to cache

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

I am not able to retrieve the values in App-B

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

it is simply returning as Nothing. what i am doing wrong?

Scion answered 15/10, 2013 at 15:16 Comment(3)
HttpRuntime.Cache exists in the app domain, so no you can't access it from another app. You'll need to expose that cache via wcf, http, etc if you want another app to access it. Also consider using a distributed cache.Nguyen
I think it's better to use Redis or Memcached.Admeasurement
Someone else asked this: #1244605Clarethaclaretta
N
8

HttpRuntime.Cache exists in the app domain, so no you can't access it from another app. You'll need to expose that cache via wcf, web api, etc if you want another app to access it. Also consider using a distributed cache.

Nguyen answered 15/10, 2013 at 15:23 Comment(1)
Thanks a lot for your valuable answer.Scion

© 2022 - 2024 — McMap. All rights reserved.