[core] Privatize SQLiteCache
This commit is contained in:
@@ -5,16 +5,17 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class FileCache;
|
||||
|
||||
class DefaultFileSource : public FileSource {
|
||||
public:
|
||||
DefaultFileSource(FileCache*, const std::string& root = "");
|
||||
DefaultFileSource(const std::string& cachePath = ":memory:", const std::string& root = "");
|
||||
~DefaultFileSource() override;
|
||||
|
||||
void setAccessToken(const std::string&);
|
||||
std::string getAccessToken() const;
|
||||
|
||||
void setMaximumCacheSize(uint64_t size);
|
||||
void setMaximumCacheEntrySize(uint64_t size);
|
||||
|
||||
std::unique_ptr<FileRequest> request(const Resource&, Callback) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef MBGL_STORAGE_DEFAULT_SQLITE_CACHE
|
||||
#define MBGL_STORAGE_DEFAULT_SQLITE_CACHE
|
||||
|
||||
#include <mbgl/storage/file_cache.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace util {
|
||||
template <typename T> class Thread;
|
||||
} // namespace util
|
||||
|
||||
class SQLiteCache : public FileCache {
|
||||
public:
|
||||
SQLiteCache(const std::string &path = ":memory:");
|
||||
~SQLiteCache() override;
|
||||
|
||||
void setMaximumCacheSize(uint64_t size);
|
||||
void setMaximumCacheEntrySize(uint64_t size);
|
||||
|
||||
// FileCache API
|
||||
std::unique_ptr<WorkRequest> get(const Resource &resource, Callback callback) override;
|
||||
void put(const Resource &resource, std::shared_ptr<const Response> response, Hint hint) override;
|
||||
|
||||
class Impl;
|
||||
|
||||
private:
|
||||
const std::unique_ptr<util::Thread<Impl>> thread;
|
||||
};
|
||||
|
||||
class SharedSQLiteCache : util::noncopyable {
|
||||
public:
|
||||
static std::shared_ptr<SQLiteCache> get(const std::string &path = ":memory:");
|
||||
|
||||
private:
|
||||
SharedSQLiteCache() {}
|
||||
|
||||
static std::weak_ptr<SQLiteCache> masterPtr;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user