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