GenericDataCache Class
template <typename T> class QInstaller::GenericDataCacheThe GenericDataCache is a template class for a checksum based storage of items on disk. More...
Header: | #include <GenericDataCache> |
Inherited By: |
Public Types
enum | RegisterMode { Copy, Move } |
Public Functions
GenericDataCache(const QString &path, const QString &type, const QString &version) | |
GenericDataCache() | |
virtual | ~GenericDataCache() |
Detailed Description
GenericDataCache<T> manages a cache storage for a set path(), which contains a subdirectory for each registered item. An item of type T
should implement methods declared in the CacheableItem interface. The GenericDataCache<T> class can still be explicitly specialized to use the derived type as a template argument, to allow retrieving items as the derived type without casting.
Each cache has a manifest file in its root directory, which lists the version and wrapped type of the cache, and all its items. The file is updated automatically when the cache object is destructed, or it can be updated periodically by calling sync().
Member Type Documentation
enum GenericDataCache::RegisterMode
This enum holds the possible values for modes of registering items to cache.
Constant | Value | Description |
---|---|---|
QInstaller::GenericDataCache::Copy | 0 | The contents of the item are copied to the cache. |
QInstaller::GenericDataCache::Move | 1 | The contents of the item are move to the cache. |
Member Function Documentation
GenericDataCache::GenericDataCache(const QString &path, const QString &type, const QString &version)
Constructs a cache to path with the given type and version. The cache is initialized automatically.
GenericDataCache::GenericDataCache()
Constructs a new empty cache. The cache is invalid until set with a path and initialized.
[virtual]
GenericDataCache::~GenericDataCache()
Deletes the cache object. Item contents on disk are kept.