Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
haio_cache.hpp File Reference
#include "haio.hpp"
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/awaitable.hpp>
#include <chrono>
#include <filesystem>
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
Include dependency graph for haio_cache.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Haio::Cdn::CacheEntry
struct  Haio::Cdn::CacheConfig
class  Haio::Cdn::CacheStore
class  Haio::Cdn::Cache

Namespaces

namespace  Haio
namespace  Haio::Cdn

Functions

std::string Haio::Cdn::cacheKey (std::string_view bucket, std::string_view path, std::string_view query)
std::vector< uint8_t > Haio::Cdn::encodeEntry (const CacheEntry &entry)
std::optional< CacheEntry > Haio::Cdn::decodeEntry (std::span< const uint8_t > raw)
std::unique_ptr< CacheStore > Haio::Cdn::makeMemoryStore (size_t maxUsage, std::chrono::seconds ttl)
std::unique_ptr< CacheStore > Haio::Cdn::makeFileStore (std::filesystem::path root, std::chrono::seconds ttl, size_t maxUsage)
std::unique_ptr< CacheStore > Haio::Cdn::makeRedisStore (std::string url, std::chrono::seconds ttl, size_t maxUsage, boost::asio::any_io_executor executor)

Class Documentation

◆ Haio::Cdn::CacheEntry

struct Haio::Cdn::CacheEntry

what the cache holds is a finished response, not an image: the work being saved is the fetch and the whole conversion behind it, so replaying an entry costs a copy.

Definition at line 22 of file haio_cache.hpp.

Class Members
string contentType
vector< uint8_t > data
string filename

◆ Haio::Cdn::CacheConfig

struct Haio::Cdn::CacheConfig

Definition at line 28 of file haio_cache.hpp.

Class Members
size_t maxUsage = 64u << 20
seconds ttl {0}
string url