Enterprise Library Caching 4.1 (Caching)

Aug 4, 2009 at 3:24 AM

Hello,

         I am using Enterprise Library 4.1 Caching mechanism. I have an xml and which will be updated once in 2 months. So I thought of trying to have caching based on file dependency. Everything works fine for me. Once the xml file modified it updates the cache immediately. But one thing i noticed if there is not hit for sometimes around 30-40 mins (not sure whether it is always 30-50 mins). Probably after a gap of around 45 mins it updates the cache again. If i am right it should update only when there is an xml change. I didn't drop any dll or restart IIS or not even change web.config. What coudl be the reason? below i am providing by sample code which i am using

 

 

<font size="2">

MenuCacheMgr = 

</font>

ICacheManager MenuCacheMgr;CacheFactory.GetCacheManager() as CacheManager;

Dictionary<string, string> MenuList = null;

if (MenuCacheMgr["MenuContentsList"] == null) 

{

MenuCacheMgr.Flush();

}

 if ( !MenuCacheMgr.Contains("MenuContentsList"))

{

 

<font size="2">

 

</font>

 

if (System.IO.File.Exists(MenuLocation))

{

<font size="2">

 

</font>

 

FileDependency expirationNotice = new FileDependency(MenuLocation);

//... do some operations to update dictionary object

<font size="2">

MenuCacheMgr.Add(

</font>

"MenuContentsList", MenuList, CacheItemPriority.NotRemovable, null, expirationNotice);

}

else

{

// read from cache

<font size="2">

MenuList = (

</font>

Dictionary<string, string>)MenuCacheMgr["MenuContentsList"];

}

 

 

Do Let me know what could be problem?

 

Regards,

Elango

 

 

 

Aug 6, 2009 at 2:16 PM

Hello,

You've reached the discussions for the CodePlex web site itself. I recommend posting this on the Enterprise Library project discussions where you may get a response.

Thanks,
Matt