Network Cache!

Published Monday August 4th, 2008
2 Comments on Network Cache!
Posted in Internet, Qt, WebKit

The past few weeks I have been hacking on another feature in Qt. Going with the theme of making Qt 4.5 faster I added a cache system to QNetworkAccessManager and provided a simple QNetworkDiskCache that can be used by most applications. Under the hood the new http backend has been enhanced to support all the http rfc cache features you would expect (even behave better than FireFox in one case). Adding a cache system is very important to a lot of our customers.

– Anyone who wants to use rss/atom feeds absolutely must have a cache system in place.
– Anyone who uses QtWebKit has been looking forward to a cache system.
– Any other application that pulls down files off the network such as in XMLPatterns can use the cache to improve performance and reduce network overhead.

To store the cache QDesktopServices::storageLocation has a new enum CacheLocation that can be used to determine a proper cross platform location for where cache files can be stored. The included QNetworkDiskCache is simple and should be good enough for a lot of customers, but for those that want to write a highly optimized one for small devices or to hook into another cache system (such as MSIE’s) the interface QAbstractNetworkCache is provided so you can implement custom cache systems.

For many applications enabling the cache will be as simple as:

QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);

To see it in action you can checkout the demo browser the 4.5 snapshots where I have enabled it.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Internet, Qt, WebKit


ariya says:

Yay! Towards a flying Arora!

mart says:

Glad someone’s having some success with QNetworkAccessManager…
I spent last night trying to subclass it in Jambi, and use it for a QWebFrame/QWebPage – so far, all I’ve managed to do is kill the JVM a few dozen times :o( One begins to wonder if it’s even possible…

I do like Arora though. ๐Ÿ™‚

Commenting closed.

Get started today with Qt Download now