mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
refs #494 Get the filename used for serializing a specific cached value, or list of all files used by whole cache.
This commit is contained in:
@@ -278,6 +278,19 @@ namespace BlackMisc
|
||||
return {};
|
||||
}
|
||||
|
||||
QString CValueCache::filenameForKey(const QString &key)
|
||||
{
|
||||
return key.section('/', 0, 0) + ".json";
|
||||
}
|
||||
|
||||
QStringList CValueCache::enumerateFiles(const QString &dir) const
|
||||
{
|
||||
auto values = getAllValues();
|
||||
QSet<QString> files;
|
||||
for (auto it = values.begin(); it != values.end(); ++it) { files.insert(dir + "/" + filenameForKey(it.key())); }
|
||||
return files.toList();
|
||||
}
|
||||
|
||||
void CValueCache::clearAllValues(const QString &keyPrefix)
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
@@ -393,6 +406,11 @@ namespace BlackMisc
|
||||
return error;
|
||||
}
|
||||
|
||||
const QString &CValuePage::getKey(const Element &element) const
|
||||
{
|
||||
return element.m_key;
|
||||
}
|
||||
|
||||
qint64 CValuePage::getTimestamp(const Element &element) const
|
||||
{
|
||||
return element.m_timestamp;
|
||||
|
||||
Reference in New Issue
Block a user