realXtend/naali — pull request #270 by jonnenauha (2011-11-07 16:28:15+00:00)
Title: New AssetCache

* Removes QNetworkDiskCache inheritance and usage completely.
* You can now set and get last modified time for cache files with LastModified() and SetLastModified(). This removes the need for metadata file per cached file for reserving last modified date.
* Implements our own HEAD operation before GET in HttpAssetProvider to inspect the cache vs source date modified time. Body GET will be done only if server has newer data than our cache.
* Makes the AssetAPI to asset providers flow more fluent before a existing cache file is used. (Removes the need for below hack FindInCache)
* Deprecate AssetCache::FindInCache as it was there only to hack around the previous implementations weaknesses. Prints a deprecated LogWaning but still works. To be removed when script have migrated.

Thats it in a nutshell. I implemented the linux side on ubuntu 11.10 and seemed to work as expected. Feedback is welcome for potential fixes or other stuff.

For the future if we need more metadata for cache items than just a simple QDateTime we need a more elaborate disk cache. This would probably include meatadata QHash in IAsset and some kind of single file fast database file on disk. For the current providers that use cache (http provider) this is sufficient and better design than the QNetworkDiskCache could give us (in terms of full control). Also disk I/O could be threaded but that will require some new work flow with AssetAPI <-> AssetCache <-> Asset Providers, basically new signals for things to wait for disk I/O completion, with the current flow this cannot be done (but doable without touching anything outside Asset lib or without API changes.)