6#include <unordered_map>
8#include <userver/components/component_fwd.hpp>
9#include <userver/dynamic_config/snapshot.hpp>
10#include <userver/formats/json_fwd.hpp>
11#include <userver/yaml_config/fwd.hpp>
13USERVER_NAMESPACE_BEGIN
17enum class BackgroundUpdateMode {
22struct LruCacheConfig
final {
24 explicit LruCacheConfig(
const components::ComponentConfig& config);
26 explicit LruCacheConfig(
const formats::
json::Value& value);
28 std::size_t GetWaySize(std::size_t ways)
const;
31 std::chrono::milliseconds lifetime;
32 BackgroundUpdateMode background_update;
37struct LruCacheConfigStatic
final {
39 explicit LruCacheConfigStatic(
const components::ComponentConfig& config);
41 std::size_t GetWaySize()
const;
43 LruCacheConfig config;
45 bool use_dynamic_config;
48extern const dynamic_config::Key<std::unordered_map<std::string, LruCacheConfig>> kLruCacheConfigSet;
50std::optional<LruCacheConfig> GetLruConfig(
const dynamic_config::Snapshot& config,
const std::string& cache_name);