9#include <userver/cache/cache_statistics.hpp>
10#include <userver/cache/update_type.hpp>
11#include <userver/components/component_fwd.hpp>
12#include <userver/dump/fwd.hpp>
13#include <userver/engine/task/task_processor_fwd.hpp>
14#include <userver/rcu/fwd.hpp>
15#include <userver/utils/flags.hpp>
17USERVER_NAMESPACE_BEGIN
21struct CacheDependencies;
44 const std::string&
Name()
const;
49 CacheUpdateTrait(
const components::ComponentConfig& config,
const components::ComponentContext& context);
52 explicit CacheUpdateTrait(CacheDependencies&& dependencies);
54 virtual ~CacheUpdateTrait();
76 void AssertPeriodicUpdateStarted();
78 void AssertPeriodicUpdateStopped();
86 rcu::ReadablePtr<Config> GetConfig()
const;
90 bool HasPreAssignCheck()
const;
94 bool IsSafeDataLifetime()
const;
97 void SetDataSizeStatistic(std::size_t size)
noexcept;
101 engine::TaskProcessor& GetCacheTaskProcessor()
const;
141 const std::chrono::system_clock::time_point& last_update,
142 const std::chrono::system_clock::time_point& now,
143 UpdateStatisticsScope& stats_scope
147 virtual void Cleanup() = 0;
149 virtual void MarkAsExpired();
151 virtual void GetAndWrite(
dump::
Writer& writer)
const;
153 virtual void ReadAndSet(
dump::
Reader& reader);
156 std::unique_ptr<Impl> impl_;