0

我们有一个 WPF 应用程序,它使用XDocument.Load()函数从我们的 MVC 网站通过 url 请求 RSS 提要 。尽管在 MVC Web 应用程序中我们将 RSS 页面缓存了 15 分钟,但 wpf 应用程序仍然在每次忽略服务器中的缓存时都请求一个新的 rss 页面。我们如何在 WPF 应用程序中使用缓存页面?

这是代码:

Path.Combine((Directory.GetParent(App.DisplayFilePath)).Name, "RSS.xml");

XDocument doc;

doc = XDocument.Load(this.FeedUri.AbsoluteUri);
doc.Save(cacheXmlFile);

doc = XDocument.Load(cacheXmlFile);

var feedItems = from feed in doc.Descendants("item");

这是服务器端 mvc 应用程序中的代码:

[OutputCache(Duration = 900, VaryByParam = "*")]
public RssActionResult GetBranches(int gid = -1, string gname = "", int t = -1,
                                   int tgap = 0)
{            
    var feedItems = new List<feedItem>();
    var branches = db.usp_GetBranch(gid, gname, t, tgap).ToList();
    feed.Items = feedItems;
    return new RssActionResult() { Feed = feed };
}

WPF 应用程序通过服务器端的 url 请求此操作。OutputCache 属性是否正常?

4

0 回答 0