userver: userver/components/fs_cache.hpp Source File
Loading...
Searching...
No Matches
fs_cache.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/components/fs_cache.hpp
4/// @brief @copybrief components::FsCache
5
6#include <unordered_map>
7#include <userver/components/loggable_component_base.hpp>
8#include <userver/fs/fs_cache_client.hpp>
9#include <userver/yaml_config/fwd.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace components {
14
15// clang-format off
16
17/// @ingroup userver_components
18///
19/// @brief Component for storing files in memory
20/// ## Static options:
21///
22/// Name | Description | Default value
23/// ----------------- | ---------------------------------------------------- | -------------
24/// dir | directory to cache files from   | /var/www
25/// update-period | Update period (0 - fill the cache only at startup) | 0
26/// fs-task-processor | task processor to do filesystem operations | fs-task-processor
27
28// clang-format on
29
30class FsCache final : public components::LoggableComponentBase {
31 public:
32 using Client = fs::FsCacheClient;
33
34 FsCache(const components::ComponentConfig& config,
35 const components::ComponentContext& context);
36
37 static yaml_config::Schema GetStaticConfigSchema();
38
39 const Client& GetClient() const;
40
41 private:
42 Client client_;
43};
44
45template <>
46inline constexpr bool kHasValidate<FsCache> = true;
47
48} // namespace components
49
50USERVER_NAMESPACE_END