userver: components::PostgreCache< PostgreCachePolicy > Class Template Reference
Loading...
Searching...
No Matches
components::PostgreCache< PostgreCachePolicy > Class Template Referencefinal

#include <userver/cache/base_postgres_cache.hpp>

Detailed Description

template<typename PostgreCachePolicy>
class components::PostgreCache< PostgreCachePolicy >

Caching component for PostgreSQL. See Caching Component for PostgreSQL.

See also
Caching Component for PostgreSQL, Basics of Caches
Examples
samples/postgres_auth/user_info_cache.hpp.

Definition at line 379 of file base_postgres_cache.hpp.

+ Inheritance diagram for components::PostgreCache< PostgreCachePolicy >:
+ Collaboration diagram for components::PostgreCache< PostgreCachePolicy >:

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
 
using BaseType = typename PolicyCheckerType::BaseType
 
- Public Types inherited from components::CachingComponentBase< T >
using DataType = T
 

Public Member Functions

 PostgreCache (const ComponentConfig &, const ComponentContext &)
 
- Public Member Functions inherited from components::CachingComponentBase< T >
 CachingComponentBase (const ComponentConfig &config, const ComponentContext &)
 
utils::SharedReadablePtr< T > Get () const
 
utils::SharedReadablePtr< T > GetUnsafe () const
 
template<class Class >
concurrent::AsyncEventSubscriberScope UpdateAndListen (Class *obj, std::string name, void(Class::*func)(const std::shared_ptr< const T > &))
 
concurrent::AsyncEventChannel< const std::shared_ptr< const T > & > & GetEventChannel ()
 
- Public Member Functions inherited from components::ComponentBase
 ComponentBase (const ComponentConfig &, const ComponentContext &)
 
 ComponentBase (ComponentBase &&)=delete
 
 ComponentBase (const ComponentBase &)=delete
 
 ~ComponentBase () override=default
 
ComponentHealth GetComponentHealth () const override
 
void OnLoadingCancelled () override
 
void OnAllComponentsLoaded () override
 
void OnAllComponentsAreStopping () override
 
- Public Member Functions inherited from components::RawComponentBase
 RawComponentBase (RawComponentBase &&)=delete
 
 RawComponentBase (const RawComponentBase &)=delete
 

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()
 
- Static Public Member Functions inherited from components::CachingComponentBase< T >
static yaml_config::Schema GetStaticConfigSchema ()
 
- Static Public Member Functions inherited from components::ComponentBase
static yaml_config::Schema GetStaticConfigSchema ()
 
- Static Public Member Functions inherited from components::RawComponentBase
static yaml_config::Schema GetStaticConfigSchema ()
 

Static Public Attributes

static constexpr bool kIncrementalUpdates
 
static constexpr auto kClusterHostTypeFlags
 
static constexpr auto kName = PolicyType::kName
 

Additional Inherited Members

- Protected Types inherited from components::ComponentBase
using LoggableComponentBase = ComponentBase
 Legacy alias, use ComponentBase instead.
 
- Protected Types inherited from cache::CacheUpdateTrait
enum class  Flag {
  kNone = 0 ,
  kNoFirstUpdate = 1 << 0
}
 Periodic update flags. More...
 
- Protected Member Functions inherited from components::CachingComponentBase< T >
void Set (std::unique_ptr< const T > value_ptr)
 
void Set (T &&value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename... Args>
void Emplace (Args &&... args)
 
void Clear ()
 Clears the content of the cache by string a default constructed T.
 
virtual void PreAssignCheck (const T *old_value_ptr, const T *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 WriteContents (dump::Writer &writer, const T &contents) const
 
virtual std::unique_ptr< const T > ReadContents (dump::Reader &reader) const
 
- Protected Member Functions inherited from cache::CacheUpdateTrait
AllowedUpdateTypes GetAllowedUpdateTypes () const
 Update types configured for the cache.
 
void StartPeriodicUpdates (utils::Flags< Flag > flags={})
 Starts periodic updates.
 
void StopPeriodicUpdates ()
 Stops periodic updates.
 
void AssertPeriodicUpdateStarted ()
 
void OnCacheModified ()
 
 CacheUpdateTrait (CacheUpdateTrait &&)=delete
 
CacheUpdateTraitoperator= (CacheUpdateTrait &&)=delete
 
void InvalidateAsync (UpdateType update_type)
 Non-blocking forced cache update of specified type.
 
void UpdateSyncDebug (UpdateType update_type)
 Forces a cache update of specified type.
 
const std::string & Name () const
 

Member Typedef Documentation

◆ BaseType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::BaseType = typename PolicyCheckerType::BaseType

Definition at line 390 of file base_postgres_cache.hpp.

◆ DataType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::DataType = pg_cache::detail::DataCacheContainerType<PolicyType>

Definition at line 386 of file base_postgres_cache.hpp.

◆ PolicyCheckerType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::PolicyCheckerType = pg_cache::detail::PolicyChecker<PostgreCachePolicy>

Definition at line 387 of file base_postgres_cache.hpp.

◆ PolicyType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::PolicyType = PostgreCachePolicy

Definition at line 383 of file base_postgres_cache.hpp.

◆ RawValueType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::RawValueType = pg_cache::detail::RawValueType<PolicyType>

Definition at line 385 of file base_postgres_cache.hpp.

◆ UpdatedFieldType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::UpdatedFieldType
Initial value:
pg_cache::detail::UpdatedFieldType<PostgreCachePolicy>

Definition at line 388 of file base_postgres_cache.hpp.

◆ ValueType

template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::ValueType = pg_cache::detail::ValueType<PolicyType>

Definition at line 384 of file base_postgres_cache.hpp.

Constructor & Destructor Documentation

◆ PostgreCache()

template<typename PostgreCachePolicy >
components::PostgreCache< PostgreCachePolicy >::PostgreCache ( const ComponentConfig & config,
const ComponentContext & context )

Definition at line 442 of file base_postgres_cache.hpp.

◆ ~PostgreCache()

template<typename PostgreCachePolicy >
components::PostgreCache< PostgreCachePolicy >::~PostgreCache ( )
override

Definition at line 494 of file base_postgres_cache.hpp.

Member Function Documentation

◆ GetStaticConfigSchema()

template<typename PostgreCachePolicy >
yaml_config::Schema components::PostgreCache< PostgreCachePolicy >::GetStaticConfigSchema ( )
static

Definition at line 706 of file base_postgres_cache.hpp.

Member Data Documentation

◆ kClusterHostTypeFlags

template<typename PostgreCachePolicy >
constexpr auto components::PostgreCache< PostgreCachePolicy >::kClusterHostTypeFlags
staticconstexpr
Initial value:
=
pg_cache::detail::ClusterHostType<PolicyType>()

Definition at line 395 of file base_postgres_cache.hpp.

◆ kIncrementalUpdates

template<typename PostgreCachePolicy >
constexpr bool components::PostgreCache< PostgreCachePolicy >::kIncrementalUpdates
staticconstexpr
Initial value:
=
pg_cache::detail::kWantIncrementalUpdates<PolicyType>

Definition at line 393 of file base_postgres_cache.hpp.

◆ kName

template<typename PostgreCachePolicy >
constexpr auto components::PostgreCache< PostgreCachePolicy >::kName = PolicyType::kName
staticconstexpr

Definition at line 397 of file base_postgres_cache.hpp.


The documentation for this class was generated from the following file: