![]() |
boost::taar::handler::cache_rule — A Cache-Control rule of htdocs_options::cache_rules.
// In header: <boost/taar/handler/htdocs.hpp> struct cache_rule { // public static functions static cache_rule glob(std::string, std::string); // public data members std::function< bool(std::string_view)> match; // Predicate on the relative path. std::string value; // TheCache-Controlvalue sent whenmatchaccepts the path. };
Rules are tried in order on the served file's decoded path relative to the root (no leading slash, e.g. assets/app.3f9a1c2e.js); the first whose match returns true supplies the header value.
options.cache_rules = { taar::handler::cache_rule::glob("*.woff2", "public, max-age=86400"), {[](std::string_view p) { return p.ends_with(".html"); }, "no-cache"}, };
cache_rule public static functionsstatic cache_rule glob(std::string pattern, std::string value);A rule matching a glob pattern (see
cache_rules::glob_match).
Parameters: |
|