summary refs log tree commit diff
path: root/include/Cache.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-03 21:16:31 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-03 21:16:31 +0300
commit88349eae90cc842427392ababb7903a242f17a94 (patch)
tree658d044218fa3d926b68621727e6dc1e7669529d /include/Cache.h
parentFix unicode handling of replaceEmoji (#84) (diff)
downloadnheko-88349eae90cc842427392ababb7903a242f17a94.tar.xz
Recover from corrupted cache data
Make Cache constructor exception free

fixes #74
Diffstat (limited to 'include/Cache.h')
-rw-r--r--include/Cache.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/include/Cache.h b/include/Cache.h

index 0f6e5cd2..3a98fddc 100644 --- a/include/Cache.h +++ b/include/Cache.h
@@ -35,9 +35,9 @@ public: inline void deleteData(); inline void unmount(); - inline QString memberDbName(const QString &roomid); void removeRoom(const QString &roomid); + void setup(); private: void setNextBatchToken(lmdb::txn &txn, const QString &token); @@ -59,15 +59,11 @@ Cache::unmount() isMounted_ = false; } -inline QString -Cache::memberDbName(const QString &roomid) -{ - return QString("m.%1").arg(roomid); -} - inline void Cache::deleteData() { + qInfo() << "Deleting cache data"; + if (!cacheDirectory_.isEmpty()) QDir(cacheDirectory_).removeRecursively(); }