HttpRuntime.Cache的范围

时间:2013-10-15 15:16:03

标签: c# asp.net .net vb.net httpruntime.cache

是否可以从其他应用程序中检索HttpRuntime.Cache

我有两个申请,

例如App-A,App-B

在App-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返回。我做错了什么?

1 个答案:

答案 0 :(得分:6)

应用程序域中存在

HttpRuntime.Cache,因此您无法从其他应用程序访问它。如果您希望其他应用程序访问它,您需要通过wcf,web api等公开该缓存。还要考虑使用分布式缓存。

相关问题