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); diskCache->setCacheDirectory(location); networkAccessManager->setCache(diskCache);
To see it in action you can checkout the demo browser the 4.5 snapshots where I have enabled it.