refs #494 Ability to "delete" all values in cache.

This commit is contained in:
Mathew Sutcliffe
2015-10-22 01:16:11 +01:00
parent 966eed9044
commit 8a3cb5f661
2 changed files with 13 additions and 1 deletions

View File

@@ -278,6 +278,14 @@ namespace BlackMisc
return {};
}
void CValueCache::clearAllValues(const QString &keyPrefix)
{
QMutexLocker lock(&m_mutex);
auto values = getAllValues(keyPrefix);
for (auto it = values.begin(); it != values.end(); ++it) { it.value() = CVariant(); }
changeValues({ values, QDateTime::currentMSecsSinceEpoch() });
}
CValueCache::BatchGuard CValueCache::batchChanges(QObject *owner)
{
Q_ASSERT(QThread::currentThread() == owner->thread());
@@ -464,7 +472,7 @@ namespace BlackMisc
{
if (! value.isValid())
{
return CStatusMessage(this, CStatusMessage::SeverityWarning, "Uninitialized value for " + element.m_key);
return CStatusMessage(this, CStatusMessage::SeverityDebug, "Uninitialized value for " + element.m_key);
}
else if (value.userType() != element.m_metaType)
{