Caches: method to save values given a list of keys.

This commit is contained in:
Mathew Sutcliffe
2016-06-30 22:20:32 +01:00
parent 242e041ceb
commit 843620ca3c
4 changed files with 50 additions and 0 deletions

View File

@@ -158,6 +158,10 @@ namespace BlackMisc
//! \threadsafe
BlackMisc::CVariantMap getAllValues(const QString &keyPrefix = {}) const;
//! Return map containing all given values in the cache.
//! \threadsafe
BlackMisc::CVariantMap getAllValues(const QStringList &keys) const;
//! Return map containing all values in the cache, and timestamps when they were modified.
//! \threadsafe
BlackMisc::CValueCachePacket getAllValuesWithTimestamps(const QString &keyPrefix = {}) const;
@@ -186,6 +190,10 @@ namespace BlackMisc
//! \threadsafe
CStatusMessage saveToFiles(const QString &directory, const QString &keyPrefix = {});
//! Save values to Json files in a given directory.
//! \threadsafe
CStatusMessage saveToFiles(const QString &directory, const QStringList &keys);
//! Load all values from Json files in a given directory.
//! Values already in the cache will remain in the cache unless they are overwritten.
//! \threadsafe
@@ -256,6 +264,10 @@ namespace BlackMisc
//! \threadsafe
void markAllAsSaved(const QString &keyPrefix);
//! Mark all values with given keys as having been saved.
//! \threadsafe
void markAllAsSaved(const QStringList &keys);
//! Mutex protecting operations which are critical on m_elements.
mutable QMutex m_mutex { QMutex::Recursive };