Click here to Skip to main content
15,904,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

How to set a cache object which is never expiried util i will change.

Thanks in Advance.

Regards

Rameshkumar.T
Posted

Set it in the future several years.
 
Share this answer
 
Look here at section 'To add an item to the Cache with expiration policies':
Adding Items to the Cache[^]

There are expiration policies.
The Cache class defines two fields that do this automatically: NoAbsoluteExpiration and NoSlidingExpiration. Simply set the appropriate parameter to its corresponding field value when you define an absolute or sliding expiration.
 
Share this answer
 
 
Share this answer
 
If it's an asp.net application, nothing will prevent the cache from deleting when the application shuts down because of no activity.
 
Share this answer
 
Hi All,

This source what i have used to create cache object.Also i have checked if "AppCache_Caption" cache object is available or not.

if (HttpRuntime.Cache["AppCache_Caption"] == null){HttpRuntime.Cache.Insert("AppCache_Caption", dicCache, null,System.Web.Caching.Cache.NoAbsoluteExpiration,System.Web.Caching.Cache.NoSlidingExpiration,System.Web.Caching.CacheItemPriority.Normal,null);}


Right now i have checked and created my login page page_load event. It will create cache object every time me access the login page.

What are the conditions wrong my source?

My expectation, cache object creates only one time.It will not create everytime.

Please help me

Thanks in advance

Rameshkumar.T
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900