开发者

how to delete cache in an ASP website from an ASP.NET website on same server?

I have two separate websites on the same server. One site is a forum (written in ASP Classic) where users may post information in various sections and threads etc. The other website (written in ASP.NET VB) is used for a club where users may purchase and download videos, etc. The Forum site uses caching to retain member information on each registered user. The club website has do do updates to a few of the user data fields stored on the Forum database. The problem is that I need to delete the cached information saved to cache for a specific user whenever I update the users information from the club website. Updates done on the Forum work just fine because it does delete the cache.

I have tried to access the cache from the ASP.NET club website using: Application.Contents("_mbUI-2") Which is the proper key but I get "Nothing". Since I can't access it, I can't delete it either. I guess the "Application" is separate due to the separate websites.

If I could call a page on the ASP site using xmlhttp, I could write a program to delete the cache. But, I need to call it from the code-behind, not by an event such as pressing a button and using javascript to make the http call.

I开发者_如何学Pythonf there were a way to access the cache from both websites, that would be ideal.

Any suggestions?

Thanks, James


Use an active cache that detects changes directly in the database, like SqlCacheDependency. Or use a shared cache, like memcached. Or write an interprocess communication protocol between the two processes (the ASP.Net process and the classic ASP process). Implementing web service in the Classic ASP and calling the service from your ASP.Net could be a form of IPC good enough (inefficient, but simple).

If there were a way to access the cache from both websites, that would be ideal.

Using Memcached would give you just that. Memcached has both .Net client libraries and COM client libraries, so your ASP.Net and ASP Classic could both access the same Memcached farm (the 'farm' being in your case just one Memcached service running on the IIS server host). You would prefix all items with the application namespace to avoid colitions for separated items. The shared items you could either use a shared namespace (more elegant and efficient), but this would require the two clients to marshal the same (not trivial), or you could simple have each process invalidate the cache of the other one (less eficient and more ugly, but simpler).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜