cesium-native  0.41.0
CesiumAsync::ICacheDatabase Class Referenceabstract

Provides database storage interface to cache completed request. More...

#include <CesiumAsync/ICacheDatabase.h>

Inheritance diagram for CesiumAsync::ICacheDatabase:
CesiumAsync::SqliteCache

Public Member Functions

virtual std::optional< CacheItemgetEntry (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...
 

Detailed Description

Provides database storage interface to cache completed request.

Definition at line 14 of file ICacheDatabase.h.

Member Function Documentation

◆ clearAll()

virtual bool CesiumAsync::ICacheDatabase::clearAll ( )
pure virtual

Removes all cache entries from the database.

Returns
true if the database was successfully cleared, or false if it could not be pruned due to an errror.

Implemented in CesiumAsync::SqliteCache.

◆ getEntry()

virtual std::optional<CacheItem> CesiumAsync::ICacheDatabase::getEntry ( const std::string &  key) const
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.

Parameters
keyThe unique key associated with the cache entry.
Returns
The result of the cache lookup, or std::nullopt if the key does not exist in the cache or an error occurred.

Implemented in CesiumAsync::SqliteCache.

◆ prune()

virtual bool CesiumAsync::ICacheDatabase::prune ( )
pure virtual

Remove cache entries from the database to satisfy the database invariant condition (.e.g exired response or LRU).

Returns
true if the database was successfully pruned, or false if it could not be pruned due to an errror.

Implemented in CesiumAsync::SqliteCache.

◆ storeEntry()

virtual bool CesiumAsync::ICacheDatabase::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 
)
pure virtual

Store a cache entry in the database.

Parameters
keythe unique key associated with the response
expiryTimethe time point that this response should be expired. An expired response will be removed when prunning the database.
urlThe URL being cached.
requestMethodThe HTTP method being cached.
requestHeadersThe HTTP request headers being cached.
statusCodeThe HTTP response status code being cached.
responseHeadersThe HTTP response headers being cached.
responseDataThe HTTP response being cached.
Returns
true if the entry was successfully stored, or false if it could not be stored due to an error.

Implemented in CesiumAsync::SqliteCache.


The documentation for this class was generated from the following file: