We have been using a DynamicImage control to display images stored in the database, it makes use of the Cache feature to store the byte stream of the image. Recently we noticed that we were getting "red X’s" displayed on our site for no specific reason, after a bit of research (I contacted MS) and searching the web it seems that the Cache is a bit agressive and the cache was getting flushed. This occurred when we upgraded from Beta 2 to RTM on our x32 bit platform, but since upgrading to our x64 platform it occurred on a much more frequent basis.
Microsoft is aware of the problem but no fix exists at the moment, the work around I found below seems to address the issue we were experiencing.
This is the line of code I changed to address the problem:
Before:
Page.Cache.Add(StorageKey,
data,
null,
Cache.NoAbsoluteExpiration,
TimeSpan.FromMinutes(5),
CacheItemPriority.High,
null);
After:
Page.Cache.Insert(StorageKey,
data,
null,
Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable,
null);
The DynamicImage control is from Dino Esposito’s MSDN column Cutting Edge located here. When Mirosoft removed the DynamicImage control from ASP.NET 2.0 we used this version instead for 2.0.
Thank you!I thought the cache kept on flushing. Now I have the solution.
LikeLike