cesium-native
0.41.0
|
Provides database storage interface to cache completed request. More...
#include <CesiumAsync/ICacheDatabase.h>
Public Member Functions | |
virtual std::optional< CacheItem > | getEntry (const std::string &key) const =0 |
Gets a cache entry from the database. More... | |
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)=0 |
Store a cache entry in the database. More... | |
virtual bool | prune ()=0 |
Remove cache entries from the database to satisfy the database invariant condition (.e.g exired response or LRU). More... | |
virtual bool | clearAll ()=0 |
Removes all cache entries from the database. More... | |
Provides database storage interface to cache completed request.
Definition at line 14 of file ICacheDatabase.h.
|
pure virtual |
Removes all cache entries from the database.
true
if the database was successfully cleared, or false
if it could not be pruned due to an errror. Implemented in CesiumAsync::SqliteCache.
|
pure virtual |
Gets a cache entry from the database.
If an error prevents checking the database for the key, this function, depending on the implementation, may log the error. However, it should return std::nullopt
. It should not throw an exception.
key | The unique key associated with the cache entry. |
std::nullopt
if the key does not exist in the cache or an error occurred. Implemented in CesiumAsync::SqliteCache.
|
pure virtual |
Remove cache entries from the database to satisfy the database invariant condition (.e.g exired response or LRU).
true
if the database was successfully pruned, or false
if it could not be pruned due to an errror. Implemented in CesiumAsync::SqliteCache.
|
pure virtual |
Store a cache entry in the database.
key | the unique key associated with the response |
expiryTime | the time point that this response should be expired. An expired response will be removed when prunning the database. |
url | The URL being cached. |
requestMethod | The HTTP method being cached. |
requestHeaders | The HTTP request headers being cached. |
statusCode | The HTTP response status code being cached. |
responseHeaders | The HTTP response headers being cached. |
responseData | The HTTP response being cached. |
true
if the entry was successfully stored, or false
if it could not be stored due to an error. Implemented in CesiumAsync::SqliteCache.