#include <userver/cache/base_postgres_cache.hpp>
Caching component for PostgreSQL. See Caching Component for PostgreSQL.
Definition at line 395 of file base_postgres_cache.hpp.
Public Types | |
using | PolicyType = PostgreCachePolicy |
using | ValueType = pg_cache::detail::ValueType<PolicyType> |
using | RawValueType = pg_cache::detail::RawValueType<PolicyType> |
using | DataType = pg_cache::detail::DataCacheContainerType<PolicyType> |
using | PolicyCheckerType = pg_cache::detail::PolicyChecker<PostgreCachePolicy> |
using | UpdatedFieldType = pg_cache::detail::UpdatedFieldType<PostgreCachePolicy> |
using | BaseType = typename PolicyCheckerType::BaseType |
Public Member Functions | |
PostgreCache (const ComponentConfig &, const ComponentContext &) | |
utils::SharedReadablePtr< DataCacheContainerType< PostgreCachePolicy > > | Get () const |
utils::SharedReadablePtr< DataCacheContainerType< PostgreCachePolicy > > | Get () const |
utils::SharedReadablePtr< DataCacheContainerType< PostgreCachePolicy > > | GetUnsafe () const |
utils::SharedReadablePtr< DataCacheContainerType< PostgreCachePolicy > > | GetUnsafe () const |
concurrent::AsyncEventSubscriberScope | UpdateAndListen (Class *obj, std::string name, void(Class::*func)(const std::shared_ptr< const DataCacheContainerType< PostgreCachePolicy > > &)) |
concurrent::AsyncEventSubscriberScope | UpdateAndListen (Class *obj, std::string name, void(Class::*func)(const std::shared_ptr< const DataCacheContainerType< PostgreCachePolicy > > &)) |
concurrent::AsyncEventChannel< const std::shared_ptr< const DataCacheContainerType< PostgreCachePolicy > > & > & | GetEventChannel () |
concurrent::AsyncEventChannel< const std::shared_ptr< const DataCacheContainerType< PostgreCachePolicy > > & > & | GetEventChannel () |
const std::string & | Name () const |
const std::string & | Name () const |
void | InvalidateAsync (UpdateType update_type) |
Non-blocking forced cache update of specified type. | |
void | InvalidateAsync (UpdateType update_type) |
Non-blocking forced cache update of specified type. | |
void | InvalidateAsync (UpdateType update_type) |
Non-blocking forced cache update of specified type. | |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsAreStopping () override |
void | UpdateSyncDebug (UpdateType update_type) |
Forces a cache update of specified type. | |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
static constexpr bool | kIncrementalUpdates = pg_cache::detail::kWantIncrementalUpdates<PolicyType> |
static constexpr auto | kClusterHostTypeFlags = pg_cache::detail::ClusterHostType<PolicyType>() |
static constexpr auto | kName = PolicyType::kName |
Protected Types | |
using | LoggableComponentBase |
enum | Flag |
Periodic update flags. More... | |
Protected Member Functions | |
void | Set (std::unique_ptr< const DataCacheContainerType< PostgreCachePolicy > > value_ptr) |
void | Set (DataCacheContainerType< PostgreCachePolicy > &&value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Set (std::unique_ptr< const DataCacheContainerType< PostgreCachePolicy > > value_ptr) |
void | Set (DataCacheContainerType< PostgreCachePolicy > &&value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Emplace (Args &&... args) |
void | Emplace (Args &&... args) |
void | Clear () |
Clears the content of the cache by string a default constructed T. | |
void | Clear () |
Clears the content of the cache by string a default constructed T. | |
virtual void | PreAssignCheck (const DataCacheContainerType< PostgreCachePolicy > *old_value_ptr, const DataCacheContainerType< PostgreCachePolicy > *new_value_ptr) const |
If the option has-pre-assign-check is set true in static config, this function is called before assigning the new value to the cache. | |
virtual void | PreAssignCheck (const DataCacheContainerType< PostgreCachePolicy > *old_value_ptr, const DataCacheContainerType< PostgreCachePolicy > *new_value_ptr) const |
If the option has-pre-assign-check is set true in static config, this function is called before assigning the new value to the cache. | |
void | UpdateSyncDebug (UpdateType update_type) |
Forces a cache update of specified type. | |
AllowedUpdateTypes | GetAllowedUpdateTypes () const |
Update types configured for the cache. | |
void | StartPeriodicUpdates (utils::Flags< Flag > flags={}) |
Starts periodic updates. | |
void | StartPeriodicUpdates (utils::Flags< Flag > flags={}) |
Starts periodic updates. | |
void | StopPeriodicUpdates () |
Stops periodic updates. | |
void | AssertPeriodicUpdateStarted () |
void | AssertPeriodicUpdateStopped () |
void | OnCacheModified () |
virtual void | WriteContents (dump::Writer &writer, const DataCacheContainerType< PostgreCachePolicy > &contents) const |
virtual void | WriteContents (dump::Writer &writer, const DataCacheContainerType< PostgreCachePolicy > &contents) const |
virtual std::unique_ptr< const DataCacheContainerType< PostgreCachePolicy > > | ReadContents (dump::Reader &reader) const |
virtual std::unique_ptr< const DataCacheContainerType< PostgreCachePolicy > > | ReadContents (dump::Reader &reader) const |
using components::PostgreCache< PostgreCachePolicy >::BaseType = typename PolicyCheckerType::BaseType |
Definition at line 404 of file base_postgres_cache.hpp.
using components::PostgreCache< PostgreCachePolicy >::DataType = pg_cache::detail::DataCacheContainerType<PolicyType> |
Definition at line 401 of file base_postgres_cache.hpp.
|
protectedinherited |
Definition at line 67 of file component_base.hpp.
using components::PostgreCache< PostgreCachePolicy >::PolicyCheckerType = pg_cache::detail::PolicyChecker<PostgreCachePolicy> |
Definition at line 402 of file base_postgres_cache.hpp.
using components::PostgreCache< PostgreCachePolicy >::PolicyType = PostgreCachePolicy |
Definition at line 398 of file base_postgres_cache.hpp.
using components::PostgreCache< PostgreCachePolicy >::RawValueType = pg_cache::detail::RawValueType<PolicyType> |
Definition at line 400 of file base_postgres_cache.hpp.
using components::PostgreCache< PostgreCachePolicy >::UpdatedFieldType = pg_cache::detail::UpdatedFieldType<PostgreCachePolicy> |
Definition at line 403 of file base_postgres_cache.hpp.
using components::PostgreCache< PostgreCachePolicy >::ValueType = pg_cache::detail::ValueType<PolicyType> |
Definition at line 399 of file base_postgres_cache.hpp.
|
strongprotectedinherited |
Periodic update flags.
Definition at line 61 of file cache_update_trait.hpp.
components::PostgreCache< PostgreCachePolicy >::PostgreCache | ( | const ComponentConfig & | config, |
const ComponentContext & | context ) |
Definition at line 460 of file base_postgres_cache.hpp.
|
override |
Definition at line 508 of file base_postgres_cache.hpp.
|
protectedinherited |
Clears the content of the cache by string a default constructed T.
Definition at line 199 of file caching_component_base.hpp.
|
protectedinherited |
Definition at line 196 of file caching_component_base.hpp.
|
inherited |
nullptr
if and only if MayReturnNull
returns true
. cache::EmptyCacheError | if the contents are nullptr , and MayReturnNull returns false (which is the default behavior). |
|
inherited |
nullptr
if and only if MayReturnNull
returns true
. cache::EmptyCacheError | if the contents are nullptr , and MayReturnNull returns false (which is the default behavior). |
Definition at line 168 of file caching_component_base.hpp.
|
inlineoverrideinherited |
Override this function to inform the world of the state of your component.
Definition at line 35 of file component_base.hpp.
|
inherited |
Definition at line 179 of file caching_component_base.hpp.
|
static |
Definition at line 731 of file base_postgres_cache.hpp.
|
inherited |
MayReturnNull
.
|
inherited |
MayReturnNull
. Definition at line 171 of file caching_component_base.hpp.
|
inherited |
Non-blocking forced cache update of specified type.
|
inherited |
Non-blocking forced cache update of specified type.
|
inherited |
Non-blocking forced cache update of specified type.
|
inherited |
|
inherited |
|
inlineoverrideinherited |
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.
Definition at line 58 of file component_base.hpp.
|
protectedinherited |
Called in CachingComponentBase::Set
during update to indicate that the cached data has been modified
|
inlineoverrideinherited |
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.
Definition at line 42 of file component_base.hpp.
|
protectedvirtualinherited |
If the option has-pre-assign-check is set true in static config, this function is called before assigning the new value to the cache.
|
protectedvirtualinherited |
If the option has-pre-assign-check is set true in static config, this function is called before assigning the new value to the cache.
Definition at line 214 of file caching_component_base.hpp.
|
protectedvirtualinherited |
Definition at line 208 of file caching_component_base.hpp.
|
protectedinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 192 of file caching_component_base.hpp.
|
protectedinherited |
Sets the new value of cache. As a result the Get() member function starts returning the value passed into this function after the Update() finishes.
|
protectedinherited |
Sets the new value of cache. As a result the Get() member function starts returning the value passed into this function after the Update() finishes.
Definition at line 189 of file caching_component_base.hpp.
|
protectedinherited |
Stops periodic updates.
|
inherited |
Subscribes to cache updates using a member function. Also immediately invokes the function with the current cache contents.
|
inherited |
Subscribes to cache updates using a member function. Also immediately invokes the function with the current cache contents.
Definition at line 177 of file caching_component_base.hpp.
|
inherited |
Forces a cache update of specified type.
If | Update throws |
|
inherited |
Forces a cache update of specified type.
If | Update throws |
|
protectedvirtualinherited |
Override to use custom serialization for cache dumps
|
protectedvirtualinherited |
Override to use custom serialization for cache dumps
Definition at line 206 of file caching_component_base.hpp.
|
staticconstexpr |
Definition at line 408 of file base_postgres_cache.hpp.
|
staticconstexpr |
Definition at line 407 of file base_postgres_cache.hpp.
|
staticconstexpr |
Definition at line 409 of file base_postgres_cache.hpp.