Create SharedSQLiteCache

This commit is contained in:
Leith Bade
2015-09-16 12:45:46 +10:00
committed by Brad Leege
parent 6877888385
commit 4b587603b3
4 changed files with 25 additions and 3 deletions

View File

@@ -264,4 +264,16 @@ void SQLiteCache::Impl::refresh(const Resource& resource, int64_t expires) {
}
}
std::shared_ptr<SQLiteCache> SharedSQLiteCache::get(const std::string &path) {
std::shared_ptr<SQLiteCache> temp = masterPtr.lock();
if (!temp) {
temp.reset(new SQLiteCache(path));
masterPtr = temp;
}
return temp;
}
std::weak_ptr<SQLiteCache> SharedSQLiteCache::masterPtr;
}