cesium-native 0.43.0
Loading...
Searching...
No Matches
ICacheDatabase.h
1#pragma once
2
3#include "CacheItem.h"
4#include "IAssetRequest.h"
5#include "Library.h"
6
7#include <cstddef>
8#include <optional>
9
10namespace CesiumAsync {
14class CESIUMASYNC_API ICacheDatabase {
15public:
16 virtual ~ICacheDatabase() noexcept = default;
17
29 virtual std::optional<CacheItem> getEntry(const std::string& key) const = 0;
30
46 virtual bool storeEntry(
47 const std::string& key,
48 std::time_t expiryTime,
49 const std::string& url,
50 const std::string& requestMethod,
51 const HttpHeaders& requestHeaders,
52 uint16_t statusCode,
53 const HttpHeaders& responseHeaders,
54 const std::span<const std::byte>& responseData) = 0;
55
63 virtual bool prune() = 0;
64
71 virtual bool clearAll() = 0;
72};
73} // namespace CesiumAsync
Provides database storage interface to cache completed request.
virtual bool clearAll()=0
Removes all cache entries from the database.
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 std::span< const std::byte > &responseData)=0
Store a cache entry in the database.
virtual bool prune()=0
Remove cache entries from the database to satisfy the database invariant condition (....
virtual std::optional< CacheItem > getEntry(const std::string &key) const =0
Gets a cache entry 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.
Definition HttpHeaders.h:25