Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cache expiration

Reply
Thread Tools

Cache expiration

 
 
Steffen Loringer
Guest
Posts: n/a
 
      10-14-2004
Hi,

i like to store some data in the Cache on the server. The data should be
removed once a file on the server is changed (I'm using a
Cache.Dependency). Because the data should be reloaded into the Cache
I'm also using a callback method.
But I can't figure out, how to add the data without any time dependency.
I can't use
Cache.Insert("Test", test, cacheDependency, Nothing, Nothing,
Caching.CacheItemPriority.High, onCacheRemove) because this immediately
reloads the data.

The data should be removed if the file is changed - and only in that
case! Any ideas?

Thanks for help
Steffen

 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      10-14-2004
Steffen Loringer wrote:
> Hi,
>
> i like to store some data in the Cache on the server. The data should
> be removed once a file on the server is changed (I'm using a
> Cache.Dependency). Because the data should be reloaded into the Cache
> I'm also using a callback method.
> But I can't figure out, how to add the data without any time
> dependency. I can't use
> Cache.Insert("Test", test, cacheDependency, Nothing, Nothing,
> Caching.CacheItemPriority.High, onCacheRemove) because this
> immediately reloads the data.
>
> The data should be removed if the file is changed - and only in that
> case! Any ideas?
>
> Thanks for help
> Steffen


I personally don't use callbacks to reload data. When I store things in the Cache,
I usually have a method to retrieve it. This method checks if the item is cached.

If it is cached, return that.
If it isn't cached (file changed, never stored yet) then create the object, cache it
and return it.

For duration and time there are constants in System.Web.Caching.Cache:
NoAbsoluteExpiration and NoSlidingExpiration.

Hans Kesting


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cache Expiration Question =?Utf-8?B?QnJpYW4gTGluZGVu?= ASP .Net 1 11-16-2004 03:36 AM
Cache and Sliding Expiration Guadala Harry ASP .Net 1 11-04-2004 09:36 AM
absolute expiration doesn't expire cache Dicky Cheng ASP .Net 2 08-16-2004 02:37 AM
Remove From Cache Prior to Expiration Jeff ASP .Net 1 04-23-2004 08:01 PM
Re: Accessing Application State on a Cache Expiration Natty Gur ASP .Net 1 08-07-2003 01:29 PM



Advertisments