From ebed87ea5730f9a49d6cf6d03a2a3a8ef7e2aa52 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Tue, 8 May 2018 20:30:09 +0300 Subject: Don't use shared pointers for cache --- src/Cache.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Cache.cc') diff --git a/src/Cache.cc b/src/Cache.cc index 8964c0e0..d80834aa 100644 --- a/src/Cache.cc +++ b/src/Cache.cc @@ -53,6 +53,25 @@ static constexpr const char *NOTIFICATIONS_DB = "sent_notifications"; using CachedReceipts = std::multimap>; using Receipts = std::map>; +namespace { +Cache *instance_ = nullptr; +} + +namespace cache { +void +init(const QString &user_id, QObject *parent) +{ + if (!instance_) + instance_ = new Cache(user_id, parent); +} + +Cache * +client() +{ + return instance_; +} +} + Cache::Cache(const QString &userId, QObject *parent) : QObject{parent} , env_{nullptr} -- cgit 1.5.1