summaryrefslogtreecommitdiff
path: root/src/mbgl/storage
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-11 17:20:07 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-14 13:46:03 -0800
commit7fb5e973edbf546046defb67dd28f1275326319b (patch)
tree39240ab154af6919e15e6b1ebf52ed44f6cd6b99 /src/mbgl/storage
parentf9574e350c9634b5a4f9849fdfe66fbd84747b12 (diff)
downloadqtlocation-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')
-rw-r--r--src/mbgl/storage/request_base.hpp1
-rw-r--r--src/mbgl/storage/sqlite_cache.hpp21
2 files changed, 15 insertions, 7 deletions
diff --git a/src/mbgl/storage/request_base.hpp b/src/mbgl/storage/request_base.hpp
index a0476d49bf..e3d33571d4 100644
--- a/src/mbgl/storage/request_base.hpp
+++ b/src/mbgl/storage/request_base.hpp
@@ -2,7 +2,6 @@
#define MBGL_STORAGE_REQUEST_BASE
#include <mbgl/util/noncopyable.hpp>
-#include <mbgl/storage/file_cache.hpp>
#include <memory>
#include <functional>
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;