Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2004, 04:19 PM
Authorized User
 
Join Date: Sep 2003
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to flyin
Default Cache Expiration Doesn't Expire in the given time!

hello all,

I am trying to simulate multi-threading via the cache object. I do this by inserting a simple item into cache with a CacheItemCallback function attached to that cached item such that once that simple item expires, the cacheCallBack function gets called and does the appropriate functionality i specified.

Now to my question.

When we insert this simple Item into cache, i try to tell it to expire in DateTime.AddSeconds(1) which is essentially 1 second, but for some reason, the cacheItemCallBack Function gets called every 1 Minute, not 1 second. Does anyone have any thoughts as to why my cached item won't expire in 1 second like i told it to?

Sample Code:

Dim _Article as new Article()

_Article.Text = "HELLO WORLD"

HttpContext.Current.Cache.Insert( _
"Article-" & Me.JobID, _
_Article, _
Nothing, _
DateTime.Now.AddSeconds(1), _
System.Web.Caching.Cache.NoSlidingExpiration, _
Caching.CacheItemPriority.Low, _
New Caching.CacheItemRemovedCallback(AddressOf RunJobCallBack))

Private Sub RunJobCallBack(ByVal k As String, ByVal v As Object, ByVal r As System.Web.Caching.CacheItemRemovedReason)
    ' Do some processing once the cached item has expired.
    ' ...
End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Expiration Dates of Emails cvn6565 ASP.NET 2.0 Professional 0 October 16th, 2006 02:48 PM
Session expiration manoj_k79 Classic ASP Basics 1 October 13th, 2006 07:19 AM
Page Expiration? Thagi ASP.NET 1.x and 2.0 Application Design 2 March 7th, 2006 12:12 AM
expire time isheikh BOOK: Beginning ASP 3.0 3 June 9th, 2004 09:08 AM
Validate Expiration date mariakovacs Classic ASP Basics 4 January 26th, 2004 12:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.