summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/genericdatacache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/installer/genericdatacache.cpp')
-rw-r--r--src/libs/installer/genericdatacache.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libs/installer/genericdatacache.cpp b/src/libs/installer/genericdatacache.cpp
index 7f21a5365..1b33976c8 100644
--- a/src/libs/installer/genericdatacache.cpp
+++ b/src/libs/installer/genericdatacache.cpp
@@ -112,6 +112,11 @@ CacheableItem::~CacheableItem()
methods declared in the \l{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 \l{sync()}.
*/
/*!
@@ -273,6 +278,23 @@ bool GenericDataCache<T>::clear()
}
/*!
+ \fn template <typename T> QInstaller::GenericDataCache<T>::sync()
+
+ Synchronizes the contents of the cache to its manifest file. Returns \c true
+ if the manifest file was updates successfully, \c false otherwise.
+*/
+template<typename T>
+bool GenericDataCache<T>::sync()
+{
+ if (m_invalidated) {
+ setErrorString(QCoreApplication::translate("GenericDataCache",
+ "Cannot synchronize invalidated cache."));
+ return false;
+ }
+ return toDisk();
+}
+
+/*!
\fn template <typename T> QInstaller::GenericDataCache<T>::isValid() const
Returns \c true if the cache is valid, \c false otherwise. A cache is considered