views:

450

answers:

7

I installed DotNetNuke version 4.9.2 and I'm watching the primed cache states using Firebug and YSLOW...

All the images and javascript are cached on the client, unless I replace them... So If I upload a new LOGO image, it is no longer cached. The existing ones are cached. If i replace an existing .js file (I ran one through the minifier), it is no longer cached. If i replace the new file with the original file, they are once again cached.

I couldn't find any documentation on this... any ideas? Thanks!

+1  A: 

I found this reference:

Solving the Caching Problem

Here's where I'd love to share the brilliant debugging and problem solving skills I used to fix the problem. Only I can't, because I could never work out what was wrong. To me, it would seem that using the simple overload [setCache(key,object)] just doesn't work properly.

What I did in the end was to use the same code I used for the Url Dictionary cache. This was a different overload because it used a callback and a fixed expiration time.

Here's the code:

DateTime absoluteExpiration = DateTime.Now.Add(settings.CacheTime);
DataCache.SetCache(UrlDictKey, urlDict, null, absoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.AboveNormal, onRemove, settings.CachePersistRestart);

This code uses a different overload, and for some reason, works properly. Testing confirmed it : previously, when hammering the test server with requests, eventually it would choke up as the database loaded up on queries to the same table over and over again. Now, there would be one call to the sp, the item would be cached, and the requests could go through without choking.

Found this reference at : http://www.ifinity.com.au/Blog/Technical_Blog/EntryId/55/DotNetNuke-Caching-and-a-performance-problem/

Hope I was able to help at least or point you in the right direction.

Codex73
A: 

I don't know about DotNetNuke but you somehow need to break/kill the cache by serving a different URL for the same filename. See how the big guys do it:

Stack Overflow: /js/question.min.js?v=2527

Slashdot: images.slashdot.org/idlecore-tidied.css?T_2_5_0_244a

Digg: /css/176/global.css

bbc.co.uk: /home/release-29-7/style/homepage.min.css

cherouvim
A: 

Have you looked at the cache settings under host settings I think?

Jonathan Parker
A: 

FYI, this may be slightly off topic but DotNetNuke does a lot of it's module caching into flat files in the /portals/ directory (that is the default caching setting). Under the host menu, you can clear this cache and or change the cache settings.

DotNetNuke 5.x has been completely re-architected so you might want to check it out if you're looking for high performance. The DotNetNuke.com site's performance improved dramatically when they migrated from 4.9.x to 5.0.

ewalk
A: 

I wouldn't have thought that DNN would be serving up assets / static files (eg images). I think they would simply be served straight by IIS. Unless the url is something like this:

blah.com/GetImage.aspx?filename=logo.jpg

If your URLs don't have 'aspx' in them somewhere, then IIS is more the issue.

Chris
A: 

The caching on the client is dependent on a particular set of HTTP headers that the web server will send your browser, which you browser uses on subsequent requests for the same objects (ie, the logo image).

When you replace the file, the web server will change the response it is generating (HTTP Last-Modified/ETag headers) - which will invalidate your browsers cached copy.

A: 

Make sure that your IIS instance is set to Enable Content Expiration. I found that at several of my hosting sites this was not set and the caching was not done like it should be. I had them enable it and now my images and "static" files are caching properly.

Good Luck J

John