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,
53 explicit CacheUpdateTrait(CacheDependencies&& dependencies);
55 virtual ~CacheUpdateTrait();
77 void AssertPeriodicUpdateStarted();
79 void AssertPeriodicUpdateStopped();
87 rcu::ReadablePtr<Config> GetConfig()
const;
91 bool HasPreAssignCheck()
const;
95 bool IsSafeDataLifetime()
const;
98 void SetDataSizeStatistic(std::size_t size)
noexcept;
102 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) = 0;
146 virtual void Cleanup() = 0;
148 virtual void MarkAsExpired();
150 virtual void GetAndWrite(
dump::
Writer& writer)
const;
152 virtual void ReadAndSet(
dump::
Reader& reader);
155 std::unique_ptr<Impl> impl_;