cesium-native 0.43.0
Loading...
Searching...
No Matches
CacheItem.h
1#pragma once
2
3#include "HttpHeaders.h"
4#include "Library.h"
5
6#include <cstddef>
7#include <cstdint>
8#include <ctime>
9#include <map>
10#include <span>
11#include <vector>
12
13namespace CesiumAsync {
14
18class CESIUMASYNC_API CacheResponse {
19public:
27 uint16_t cacheStatusCode,
28 HttpHeaders&& cacheHeaders,
29 std::vector<std::byte>&& cacheData)
30 : statusCode(cacheStatusCode),
31 headers(std::move(cacheHeaders)),
32 data(std::move(cacheData)) {}
33
37 uint16_t statusCode;
38
43
47 std::vector<std::byte> data;
48};
49
53class CESIUMASYNC_API CacheRequest {
54public:
62 HttpHeaders&& cacheHeaders,
63 std::string&& cacheMethod,
64 std::string&& cacheUrl)
65 : headers(std::move(cacheHeaders)),
66 method(std::move(cacheMethod)),
67 url(std::move(cacheUrl)) {}
68
73
77 std::string method;
78
82 std::string url;
83};
84
88class CESIUMASYNC_API CacheItem {
89public:
97 std::time_t cacheExpiryTime,
98 CacheRequest&& request,
99 CacheResponse&& response)
100 : expiryTime(cacheExpiryTime),
101 cacheRequest(std::move(request)),
102 cacheResponse(std::move(response)) {}
103
107 std::time_t expiryTime;
108
113
118};
119} // namespace CesiumAsync
Cache item retrieved from the cache database.
Definition CacheItem.h:88
CacheItem(std::time_t cacheExpiryTime, CacheRequest &&request, CacheResponse &&response)
Constructor.
Definition CacheItem.h:96
CacheRequest cacheRequest
The cache request owned by this cache item.
Definition CacheItem.h:112
std::time_t expiryTime
The time point that this cache item is expired.
Definition CacheItem.h:107
CacheResponse cacheResponse
The cache response owned by this cache item.
Definition CacheItem.h:117
Cache request retrieved from the cache database.
Definition CacheItem.h:53
std::string method
The method of the request.
Definition CacheItem.h:77
std::string url
The url of the request.
Definition CacheItem.h:82
HttpHeaders headers
The headers of the request.
Definition CacheItem.h:72
CacheRequest(HttpHeaders &&cacheHeaders, std::string &&cacheMethod, std::string &&cacheUrl)
Constructor.
Definition CacheItem.h:61
Cache response retrieved from the cache database.
Definition CacheItem.h:18
HttpHeaders headers
The headers of the response.
Definition CacheItem.h:42
CacheResponse(uint16_t cacheStatusCode, HttpHeaders &&cacheHeaders, std::vector< std::byte > &&cacheData)
Constructor.
Definition CacheItem.h:26
std::vector< std::byte > data
The body data of the response.
Definition CacheItem.h:47
uint16_t statusCode
The status code of the response.
Definition CacheItem.h:37
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
STL namespace.