#include <userver/testsuite/cache_control.hpp>
Testsuite interface for caches and cache-like components.
If a component stores transient state that may be carried between tests, or stores caches that may become stale, then it should register its resetter here. Example:
Testsuite will then call this hook in the beginning of each test. You can also reset a specific cache in testsuite explicitly as follows:
CacheControl is normally acquired through testsuite::FindCacheControl.
All methods are coro-safe.
Definition at line 53 of file cache_control.hpp.
Public Member Functions | |
template<typename Component > | |
CacheResetRegistration | RegisterCache (Component *self, std::string_view name, void(Component::*reset_method)()) |
Register a cache reset function. The returned handle must be kept alive to keep supporting cache resetting. | |
void | ResetAllCaches (cache::UpdateType update_type, const std::unordered_set< std::string > &force_incremental_names) |
Reset all the registered caches. | |
void | ResetCaches (cache::UpdateType update_type, std::unordered_set< std::string > reset_only_names, const std::unordered_set< std::string > &force_incremental_names) |
Reset caches with the specified names. | |
CacheResetRegistration testsuite::CacheControl::RegisterCache | ( | Component * | self, |
std::string_view | name, | ||
void(Component::*)() | reset_method ) |
Register a cache reset function. The returned handle must be kept alive to keep supporting cache resetting.
Definition at line 165 of file cache_control.hpp.
void testsuite::CacheControl::ResetAllCaches | ( | cache::UpdateType | update_type, |
const std::unordered_set< std::string > & | force_incremental_names ) |
Reset all the registered caches.
update_type is used by caches derived from component::CachingComponentBase.
void testsuite::CacheControl::ResetCaches | ( | cache::UpdateType | update_type, |
std::unordered_set< std::string > | reset_only_names, | ||
const std::unordered_set< std::string > & | force_incremental_names ) |
Reset caches with the specified names.
update_type is used by caches derived from component::CachingComponentBase.