8#include <unordered_set>
11#include <userver/cache/update_type.hpp>
12#include <userver/components/component_fwd.hpp>
13#include <userver/engine/mutex.hpp>
14#include <userver/utils/not_null.hpp>
16USERVER_NAMESPACE_BEGIN
27class CacheControl
final {
29 enum class PeriodicUpdatesMode { kDefault, kEnabled, kDisabled };
31 explicit CacheControl(PeriodicUpdatesMode);
35 const std::string& cache_name)
const;
37 void InvalidateAllCaches(cache::
UpdateType update_type);
39 void InvalidateCaches(cache::
UpdateType update_type,
40 std::unordered_set<std::string> names);
43 friend class CacheInvalidatorHolder;
49 const PeriodicUpdatesMode periodic_updates_mode_;
52 std::vector<utils::NotNull<cache::CacheUpdateTrait*>> caches_;
56class CacheInvalidatorHolder
final {
59 ~CacheInvalidatorHolder();
61 CacheInvalidatorHolder(
const CacheInvalidatorHolder&) =
delete;
62 CacheInvalidatorHolder(CacheInvalidatorHolder&&) =
delete;
63 CacheInvalidatorHolder& operator=(
const CacheInvalidatorHolder&) =
delete;
64 CacheInvalidatorHolder& operator=(CacheInvalidatorHolder&&) =
delete;
67 CacheControl& cache_control_;