#include <userver/storages/redis/dynamic_component.hpp>
Valkey and Redis dynamic client component, that does not require secdist.
Provides access to a valkey or redis cluster.
Same as for components::Redis
| Name | Description | Default value |
|---|---|---|
| thread_pools | Thread pools options. | – |
| thread_pools.redis_thread_pool_size | Thread count to serve Redis requests. | – |
| thread_pools.sentinel_thread_pool_size | Thread count to serve sentinel requests. | – |
| metrics_level | Set metrics detail level. Possible values: cluster, shard, instance. | instance |
Options inherited from components::ComponentBase :
| Name | Description | Default value |
|---|---|---|
| load-enabled | Set to false to disable loading of the component. | true |
Definition at line 56 of file dynamic_component.hpp.
Inheritance diagram for components::DynamicRedis:Public Member Functions | |
| DynamicRedis (const ComponentConfig &config, const ComponentContext &component_context) | |
| bool | AddClient (const std::string &name, const storages::redis::DynamicSettings &settings) |
| Adds a new client with the specified name and settings. | |
| bool | RemoveClient (const std::string &name) |
| Removes a client with the specified name. | |
| utils::SharedRef< storages::redis::Client > | GetDynamicClient (const std::string &name, storages::redis::RedisWaitConnected wait_connected={}) const |
| Retrieves a dynamically added client by name. | |
| std::unordered_set< std::string > | ListDynamicClients () const |
| Lists the names of all dynamically added clients. | |
| ComponentHealth | GetComponentHealth () const override |
| void | OnLoadingCancelled () override |
| void | OnAllComponentsLoaded () override |
| void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
| static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
| static constexpr std::string_view | kName = "dynamic-redis" |
| The default name of components::DynamicRedis. | |
Protected Types | |
| using | LoggableComponentBase = ComponentBase |
|
protectedinherited |
Definition at line 67 of file component_base.hpp.
| bool components::DynamicRedis::AddClient | ( | const std::string & | name, |
| const storages::redis::DynamicSettings & | settings ) |
Adds a new client with the specified name and settings.
| name | the name of the client |
| settings | the dynamic settings for the client |
|
inlineoverridevirtualinherited |
Override this function to inform the world of the state of your component.
Reimplemented from components::RawComponentBase.
Reimplemented in server::handlers::Restart.
Definition at line 35 of file component_base.hpp.
| utils::SharedRef< storages::redis::Client > components::DynamicRedis::GetDynamicClient | ( | const std::string & | name, |
| storages::redis::RedisWaitConnected | wait_connected = {} ) const |
Retrieves a dynamically added client by name.
| name | the name of the client |
| wait_connected | wait mode for the client connection |
| std::unordered_set< std::string > components::DynamicRedis::ListDynamicClients | ( | ) | const |
Lists the names of all dynamically added clients.
|
inlineoverridevirtualinherited |
Component may use this function to stop doing work before the stop of the components that depend on it.
Base components may override it and make final to do some work before the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in components::Server, and urabbitmq::ConsumerComponentBase.
Definition at line 58 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).
Base components may override it and make final to do some work after the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in components::Server, server::handlers::Ping, and urabbitmq::ConsumerComponentBase.
Definition at line 51 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.
Reimplemented from components::RawComponentBase.
Definition at line 42 of file component_base.hpp.
| bool components::DynamicRedis::RemoveClient | ( | const std::string & | name | ) |
Removes a client with the specified name.
| name | the name of the client to remove |