summary refs log tree commit diff
path: root/include/Cache.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-08-26 14:31:23 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-08-26 14:31:23 +0300
commit177dd6a5b040212beebd0129880241cb13b6ef08 (patch)
tree5e51e9b820416193daf53bdc04c0d69cec1f63dd /include/Cache.h
parentUpdate the cache state at once to avoid being in an invalid state (diff)
downloadnheko-177dd6a5b040212beebd0129880241cb13b6ef08.tar.xz
Remove cache data when the user logs out
Diffstat (limited to 'include/Cache.h')
-rw-r--r--include/Cache.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/Cache.h b/include/Cache.h

index 46107062..1be56620 100644 --- a/include/Cache.h +++ b/include/Cache.h
@@ -17,6 +17,7 @@ #pragma once +#include <QDir> #include <lmdb++.h> #include "RoomState.h" @@ -32,6 +33,7 @@ public: QString nextBatchToken() const; QMap<QString, RoomState> states(); + inline void deleteData(); inline void unmount(); inline QString memberDbName(const QString &roomid); @@ -46,6 +48,7 @@ private: bool isMounted_; QString userId_; + QString cacheDirectory_; }; inline void @@ -59,3 +62,10 @@ Cache::memberDbName(const QString &roomid) { return QString("m.%1").arg(roomid); } + +inline void +Cache::deleteData() +{ + if (!cacheDirectory_.isEmpty()) + QDir(cacheDirectory_).removeRecursively(); +}