[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

cache items are removed automatically

o0lOlllOl0o

9/26/2006 4:04:00 PM

hi,
I am using httpruntime to cache certain objects in my application. I
need to store 4 objects in cache. but the cache items are being
removed from cache after 20-30 seconds. it is working fine if i store
only 3 objects. i am using .net 1.1. The reason i am getting in the
callback method is 'removed'.

Does anyone know how to fix this?

Thanks,
Sammy

2 Answers

Alvin Bruney [ASP.NET MVP]

10/4/2006 11:04:00 PM

0

The cache object makes no explicit guarantee that your items will be
available when you are ready to use it. Your logic should first test to see
if the object is available, it isn't then call a method to replenish the
cache. You may also want to bump the priority of the items in the cache so
that they are more immune to cache purges. Again, there's absolutely no
guarantee that this technique will result in items being always present in
the cache.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/b...
-------------------------------------------------------


<o0lOlllOl0o@gmail.com> wrote in message
news:1159286612.411674.103450@b28g2000cwb.googlegroups.com...
> hi,
> I am using httpruntime to cache certain objects in my application. I
> need to store 4 objects in cache. but the cache items are being
> removed from cache after 20-30 seconds. it is working fine if i store
> only 3 objects. i am using .net 1.1. The reason i am getting in the
> callback method is 'removed'.
>
> Does anyone know how to fix this?
>
> Thanks,
> Sammy
>


Humberto Godoy - Brazil

11/28/2006 2:15:00 PM

0

HI all,

Add the object this way.

Cache.Insert("KeyCahe", yourObject, null, DateTime.Now.AddMinutes(20),
TimeSpan.Zero);

AddMinutes(20), set the cache to expires in 20 minutes.

By

"Alvin Bruney [MVP]" wrote:

> The cache object makes no explicit guarantee that your items will be
> available when you are ready to use it. Your logic should first test to see
> if the object is available, it isn't then call a method to replenish the
> cache. You may also want to bump the priority of the items in the cache so
> that they are more immune to cache purges. Again, there's absolutely no
> guarantee that this technique will result in items being always present in
> the cache.
>
> --
> ________________________
> Warm regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Professional VSTO.NET - Wrox/Wiley
> The O.W.C. Black Book with .NET
> www.lulu.com/owc, Amazon
> Blog: http://www.msmvps.com/b...
> -------------------------------------------------------
>
>
> <o0lOlllOl0o@gmail.com> wrote in message
> news:1159286612.411674.103450@b28g2000cwb.googlegroups.com...
> > hi,
> > I am using httpruntime to cache certain objects in my application. I
> > need to store 4 objects in cache. but the cache items are being
> > removed from cache after 20-30 seconds. it is working fine if i store
> > only 3 objects. i am using .net 1.1. The reason i am getting in the
> > callback method is 'removed'.
> >
> > Does anyone know how to fix this?
> >
> > Thanks,
> > Sammy
> >
>
>
>