开发者

why can a CacheDependency be invalid right after creating it! (ASP.NET-MVC3)

Whenever I make a CacheDependency in a testbed, it works fine.

If I write

var dep = new CacheDependency(null, new string[] { "dep" });

dep will be a new CacheDependency, with the properties: HasChanged = fals开发者_JAVA技巧e, UtcLastModified = the current datetime.

But somehow in one of my projects the same line of code instantiates a cachedependency with HasChanged = true, UtcLastModified = 1/1/0001 12:00:00 AM

This dependency is invalid/useless by default. What can cause this? Is it possible that it is because I don't instantiate the dependency directly in the controller, but in an extension method of one of my objects?

But HttpRuntime.Cache works fine there without dependencies.

If you have any idea what can cause this please share.


I have found out that if the cache item that you depend on is null, then the cache dependency is automatically invalid.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜