|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
HTTP响应缓存 更多...
#include <http_cache.hpp>
Public 成员函数 | |
| optional< cached_response > | get (const string &key) |
| 获取缓存的响应 | |
| void | put (const string &key, const http_response &response, seconds max_age=-1_s) |
| 存入缓存 | |
| void | remove (const string &key) |
| 删除缓存条目 | |
| void | cleanup () |
| 清理过期条目 | |
| void | clear () |
| 清空所有缓存 | |
| size_t | size () const |
| 缓存条目数 | |
静态 Public 成员函数 | |
| static string | generate_etag (string_view body) |
| 生成ETag值 | |
| static string | build_key (const http_method &method, string_view url) |
| 构建缓存键 | |
Public 属性 | |
| seconds | default_max_age {60} |
| 默认缓存时间 | |
| size_t | max_entries {10000} |
| 最大缓存条目数 | |
| byte_size | max_body_size {1_MB} |
| 最大缓存响应体大小 | |
| optional< cached_response > neforce::http::response_cache::get | ( | const string & | key | ) |
获取缓存的响应
| key | 缓存键(通常为 method+url) |
| void neforce::http::response_cache::put | ( | const string & | key, |
| const http_response & | response, | ||
| seconds | max_age = -1_s ) |
存入缓存
| key | 缓存键 |
| response | 响应对象 |