Encuentra cuándo se agregó un elemento a un caché

So, I'm learning about caching...

I'm building a function to compress and cache JS files.

I'm trying to make it update any time I change a file though, to do this, I am trying to compare the lastWrite time of the JS files on my server and the time that the cache file was written.

So, adding the data to the cache looks like this:

HttpContext.Current.Cache.Insert("cachedJS", FileJS, Nothing, DateTime.Now.AddMinutes(1200), TimeSpan.Zero)

And I can retrieve this data easily enough, but, how do I determine the lastWriteTime of the CACHE key?

preguntado el 28 de agosto de 12 a las 12:08

1 Respuestas

You can develop extension methhod InsertWithLog and use this method to insert item in your cache, and trace the time of insertion, but it's not possible to realize this work without customization.

Here all avaiable format of Insert :http://msdn.microsoft.com/en-us/library/system.web.caching.cache.insert%28v=vs.71%29.aspx

Respondido 28 ago 12, 13:08

Ah, OK, that'll be why I can't find anything on Google about it! I'll just add a dateTime key to compare. - jamie hartnoll

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.