#include <XrdClHttpOptionsCache.hh>
|
| void | Expire (std::chrono::steady_clock::time_point now) |
| |
| HttpVerbs | Get (const std::string &url, const std::chrono::steady_clock::time_point &now=std::chrono::steady_clock::now()) const |
| |
| uint64_t | GetCacheHits () const |
| |
| uint64_t | GetCacheMisses () const |
| |
| void | Put (const std::string &url, const HttpVerbs &verbs, const std::chrono::steady_clock::time_point &now=std::chrono::steady_clock::now()) const |
| |
Definition at line 37 of file XrdClHttpOptionsCache.hh.
◆ HttpVerb
◆ Expire()
| void XrdClHttp::VerbsCache::Expire |
( |
std::chrono::steady_clock::time_point |
now | ) |
|
Definition at line 67 of file XrdClHttpOptionsCache.cc.
69 std::unique_lock lock(m_mutex);
70 for (
auto iter = m_verbs_map.begin(); iter != m_verbs_map.end();) {
71 if (iter->second.m_expiry < now) {
72 iter = m_verbs_map.erase(iter);
◆ Get()
| HttpVerbs XrdClHttp::VerbsCache::Get |
( |
const std::string & |
url, |
|
|
const std::chrono::steady_clock::time_point & |
now = std::chrono::steady_clock::now() |
|
) |
| const |
|
inline |
Definition at line 95 of file XrdClHttpOptionsCache.hh.
96 std::string modified_url;
99 const std::shared_lock sentry(m_mutex);
100 #if __cplusplus >= 202002L
101 auto iter = m_verbs_map.find(key);
103 auto iter = m_verbs_map.find(std::string(key));
105 if (iter == m_verbs_map.end()) {
109 if (iter->second.m_expiry < now) {
114 return iter->second.m_verbs;
static std::string_view GetUrlKey(const std::string &url, std::string &modified_url)
References GetUrlKey().
◆ GetCacheHits()
| uint64_t XrdClHttp::VerbsCache::GetCacheHits |
( |
| ) |
const |
|
inline |
◆ GetCacheMisses()
| uint64_t XrdClHttp::VerbsCache::GetCacheMisses |
( |
| ) |
const |
|
inline |
◆ GetUrlKey()
| static std::string_view XrdClHttp::VerbsCache::GetUrlKey |
( |
const std::string & |
url, |
|
|
std::string & |
modified_url |
|
) |
| |
|
inlinestatic |
Definition at line 120 of file XrdClHttpOptionsCache.hh.
121 auto authority_loc = url.find(
"://");
122 if (authority_loc == std::string::npos) {
123 return std::string_view();
125 auto path_loc = url.find(
'/', authority_loc + 3);
126 if (path_loc == std::string::npos) {
127 path_loc = url.length();
130 std::string_view url_view{url};
131 auto host_loc = url_view.substr(authority_loc + 3, path_loc - authority_loc - 3).find(
'@');
132 if (host_loc == std::string::npos) {
133 return url_view.substr(0, path_loc);
135 host_loc += authority_loc + 3;
136 modified_url = url.substr(0, authority_loc + 3) + std::string(url_view.substr(host_loc + 1, path_loc - host_loc - 1));
Referenced by Get(), Put(), and XrdClHttp::CurlWorker::Run().
◆ GetVerbString()
| static const std::string XrdClHttp::VerbsCache::GetVerbString |
( |
HttpVerb |
ctype | ) |
|
|
inlinestatic |
◆ Instance()
◆ Put()
| void XrdClHttp::VerbsCache::Put |
( |
const std::string & |
url, |
|
|
const HttpVerbs & |
verbs, |
|
|
const std::chrono::steady_clock::time_point & |
now = std::chrono::steady_clock::now() |
|
) |
| const |
|
inline |
Definition at line 72 of file XrdClHttpOptionsCache.hh.
73 std::string modified_url;
76 const std::unique_lock sentry(m_mutex);
79 auto lifetime = isKnown ? g_expiry_duration : g_negative_expiry_duration;
82 #if __cplusplus >= 202002L
83 auto iter = m_verbs_map.find(key);
85 auto iter = m_verbs_map.find(std::string(key));
87 if (iter == m_verbs_map.end()) {
88 m_verbs_map.emplace(key, VerbEntry{now + lifetime, verbs});
91 iter->second = {now + lifetime, verbs};
References GetUrlKey(), XrdClHttp::VerbsCache::HttpVerbs::IsSet(), and kUnknown.
The documentation for this class was generated from the following files: