Search code examples
asp.net.netvb.netmemorycachesystem.web.caching

ASP.NET MemoryCache Sharing Across Applications


I have been reading all over the place about the new MemoryCache class starting in .Net Framework 4.0. From what I've read, you can access the MemoryCache across different .Net applications. I am trying to share an object between an Asp.Net application and a standard windows forms .Net application. If I add the object to the MemoryCache in the .Net application, the Asp.Net application does not see it. Is there any way to accomplish this? Thank you for your time, it is greatly appreciated.

Windows Form App:

    Dim cache As ObjectCache = MemoryCache.Default
    Dim policy As New CacheItemPolicy()
    policy.AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(60)
    cache.Set("testcache", TestObj, policy)

Asp.Net App:

    Dim cache As ObjectCache = MemoryCache.Default
    If IsNothing(cache("testcache")) Then Response.Write("TestCache Is Nothing")

Thanks - Ryan


Solution

  • MySQL memory tables are working great and having stellar performance. 20/30 inserts a second and only around 1% CPU load.