3 #include "ICacheDatabase.h"
5 #include <spdlog/fwd.h>
32 const std::shared_ptr<spdlog::logger>& pLogger,
33 const std::string& databaseName,
34 uint64_t maxItems = 4096);
38 virtual std::optional<CacheItem>
39 getEntry(
const std::string& key)
const override;
43 const std::string& key,
44 std::time_t expiryTime,
45 const std::string& url,
46 const std::string& requestMethod,
50 const gsl::span<const std::byte>& responseData)
override;
60 std::unique_ptr<Impl> _pImpl;
61 void createConnection()
const;
62 void destroyDatabase();
Provides database storage interface to cache completed request.
Cache storage using SQLITE to store completed response.
virtual bool storeEntry(const std::string &key, std::time_t expiryTime, const std::string &url, const std::string &requestMethod, const HttpHeaders &requestHeaders, uint16_t statusCode, const HttpHeaders &responseHeaders, const gsl::span< const std::byte > &responseData) override
Store a cache entry in the database.
virtual bool prune() override
Remove cache entries from the database to satisfy the database invariant condition (....
SqliteCache(const std::shared_ptr< spdlog::logger > &pLogger, const std::string &databaseName, uint64_t maxItems=4096)
Constructs a new instance with a given databaseName pointing to a database.
virtual std::optional< CacheItem > getEntry(const std::string &key) const override
Gets a cache entry from the database.
virtual bool clearAll() override
Removes all cache entries from the database.
Classes that support asynchronous operations.
std::map< std::string, std::string, CaseInsensitiveCompare > HttpHeaders
Http Headers that maps case-insensitive header key with header value.