Pergunta

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 = false, 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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top