Cache.Add not adding

I

Ismail

I have asp.net20 web application in my class file in app_code i have
the following code:


HttpContext.Current.Cache.Insert("CampaignImage",
path, null, cacheD,
Cache.NoSlidingExpiration
);

the function where i am doing this is called from home page on my
site. the first time round it gets added to the cache (basically i
have if statement to say if not in cache then add to cache) I can see
it gets added. Now when i refresh the page the item has been dropped
from cache. Am I doing something stupid?

Many thanks


Ismail
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Ismail said:
I have asp.net20 web application in my class file in app_code i have
the following code:


HttpContext.Current.Cache.Insert("CampaignImage",
path, null, cacheD,
Cache.NoSlidingExpiration
);

the function where i am doing this is called from home page on my
site. the first time round it gets added to the cache (basically i
have if statement to say if not in cache then add to cache) I can see
it gets added. Now when i refresh the page the item has been dropped
from cache. Am I doing something stupid?

Many thanks


Ismail

Does cacheD contain a date in the future?

Is path a very large value so that it might be dropped because of that?
 
I

Ismail

Goran,

cacheD is date 1 week in future and path is string no bigger than
20chars.

Regards

Ismail
 
I

Ismail

Ok,

Fixed this thanks to help for me mate matt the code should be

HttpContext.Current.Cache.Insert("CampaignImage",
path, null, cacheD,

Cache.NoSlidingExpiration,System.Web.Caching.CacheItemPriority.NotRemovable
, null
);

This being the important bit
System.Web.Caching.CacheItemPriority.NotRemovable

Regards

Ismail
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top