diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-11 17:20:07 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-14 13:46:03 -0800 |
commit | 7fb5e973edbf546046defb67dd28f1275326319b (patch) | |
tree | 39240ab154af6919e15e6b1ebf52ed44f6cd6b99 /src/mbgl/storage/sqlite_cache.hpp | |
parent | f9574e350c9634b5a4f9849fdfe66fbd84747b12 (diff) | |
download | qtlocation-mapboxgl-7fb5e973edbf546046defb67dd28f1275326319b.tar.gz |
[core] Eliminate FileCache interface
There is only one implementation and we're unlikely to add more.
Diffstat (limited to 'src/mbgl/storage/sqlite_cache.hpp')
-rw-r--r-- | src/mbgl/storage/sqlite_cache.hpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mbgl/storage/sqlite_cache.hpp b/src/mbgl/storage/sqlite_cache.hpp index 6e79d44a33..ed94dfbc8c 100644 --- a/src/mbgl/storage/sqlite_cache.hpp +++ b/src/mbgl/storage/sqlite_cache.hpp @@ -1,27 +1,36 @@ #ifndef MBGL_STORAGE_DEFAULT_SQLITE_CACHE #define MBGL_STORAGE_DEFAULT_SQLITE_CACHE -#include <mbgl/storage/file_cache.hpp> +#include <mbgl/util/noncopyable.hpp> +#include <mbgl/util/chrono.hpp> +#include <functional> +#include <memory> #include <string> namespace mbgl { +struct Resource; +class Response; +class WorkRequest; + namespace util { template <typename T> class Thread; } // namespace util -class SQLiteCache : public FileCache { +class SQLiteCache : private util::noncopyable { public: SQLiteCache(const std::string &path = ":memory:"); - ~SQLiteCache() override; + ~SQLiteCache(); 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; + enum class Hint : bool { Full, Refresh }; + using Callback = std::function<void(std::unique_ptr<Response>)>; + + std::unique_ptr<WorkRequest> get(const Resource&, Callback); + void put(const Resource&, std::shared_ptr<const Response> response, Hint hint); class Impl; |