有什么方法可以从Asp.net网站上的缓存中删除项目? [英] Is there any way to remove an item from Cache on Asp.net web Site?

查看:56
本文介绍了有什么方法可以从Asp.net网站上的缓存中删除项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的开发站点上部署了一个修复程序,但是在测试时发现该修复程序在那儿不起作用.在研究这个问题时,我发现来自缓存的特定数据(XML文档)是错误的.我在数据库中修复了XML文档,但是由于Asp.net应用程序正在从缓存中获取XML文档,因此它正在获取旧的buggy版本的XML,因此问题仍然存在.

我有什么办法可以在不更改任何现有代码的情况下从站点的缓存中删除XML文档?

I have deployed a fix on my development site, but, while testing I found that, the fix isn''t working there. Exploring the issue, I found that, a particular data (An XML document) is wrong which is coming from the Cache. I fixed the XML document in Database, but as the Asp.net application is obtaining the XML document from the Cache, it is getting the old buggy version of the XML, and hence, the problem persists there.

Is there any way I can remove the XML document from the Site''s Cache without changing any existing code?

推荐答案

我有类似的经验,我做了什么如下:

1.我编写了一个aspx页面ClearCache.aspx(不带CodeBehind选项),其中包含以下几段标记代码:

I have similar kind of experience and what I did was as follows:

1. I wrote an aspx page ClearCache.aspx (Without the CodeBehind option) having the following little piece of markup codes:

<body>
    <form id="form1" runat="server">
    <div>
    <%
        Cache.Remove("Key");
    %>
    </div>
    </form>
</body>



2.我将aspx页面上载到了网站文件夹中,并使用URL击中了aspx页面.击中URL导致从Cache中删除了该项目.

3.我从网站文件夹中删除了aspx页面.

您可以按照类似的方法来解决您的问题.希望这会有所帮助.



2. I uploaded the aspx page in the web site folder and hit the aspx page with an URL. Hitting the URL resulted in removing the item from Cache.

3. I deleted the aspx page from the web site folder.

You can follow a similar approach to fix your issue. Hope, this helps.


这篇关于有什么方法可以从Asp.net网站上的缓存中删除项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆