mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Caches: method to query keys of all unsaved values.
This commit is contained in:
@@ -201,6 +201,17 @@ namespace BlackMisc
|
||||
return map;
|
||||
}
|
||||
|
||||
QStringList CValueCache::getAllUnsavedKeys(const QString &keyPrefix) const
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
QStringList keys;
|
||||
for (const auto &element : elementsStartingWith(keyPrefix))
|
||||
{
|
||||
if (element->m_value.isValid() && ! element->m_saved) { keys.push_back(element->m_key); }
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
void CValueCache::insertValues(const CValueCachePacket &values)
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
|
||||
@@ -171,6 +171,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
BlackMisc::CValueCachePacket getAllValuesWithTimestamps(const QString &keyPrefix = {}) const;
|
||||
|
||||
//! Return keys of all values which have been changed but not saved.
|
||||
//! \threadsafe
|
||||
QStringList getAllUnsavedKeys(const QString &keyPrefix = {}) const;
|
||||
|
||||
//! Add some values to the cache.
|
||||
//! Values already in the cache will remain in the cache unless they are overwritten.
|
||||
//! \threadsafe
|
||||
|
||||
Reference in New Issue
Block a user