#include <userver/cache/base_postgres_cache.hpp>
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 381 of file base_postgres_cache.hpp.
|
static constexpr bool | kIncrementalUpdates = pg_cache::detail::kWantIncrementalUpdates<PolicyType> |
|
static constexpr auto | kClusterHostTypeFlags = pg_cache::detail::ClusterHostType<PolicyType>() |
|
static constexpr auto | kName = PolicyType::kName |
|
|
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.
|
|
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 |
|
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 | AssertPeriodicUpdateStopped () |
|
void | OnCacheModified () |
|
|
virtual void | WriteContents (dump::Writer &writer, const T &contents) const |
|
virtual std::unique_ptr< const T > | ReadContents (dump::Reader &reader) const |
|
◆ BaseType
template<typename PostgreCachePolicy >
◆ DataType
template<typename PostgreCachePolicy >
◆ LoggableComponentBase
◆ PolicyCheckerType
template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::PolicyCheckerType = pg_cache::detail::PolicyChecker<PostgreCachePolicy> |
◆ PolicyType
template<typename PostgreCachePolicy >
◆ RawValueType
template<typename PostgreCachePolicy >
◆ UpdatedFieldType
template<typename PostgreCachePolicy >
using components::PostgreCache< PostgreCachePolicy >::UpdatedFieldType = pg_cache::detail::UpdatedFieldType<PostgreCachePolicy> |
◆ ValueType
template<typename PostgreCachePolicy >
◆ Flag
Periodic update flags.
Enumerator |
---|
kNoFirstUpdate | Disable initial update on start.
- Deprecated
- Use
first-update-fail-ok: true instead
|
Definition at line 61 of file cache_update_trait.hpp.
◆ PostgreCache()
template<typename PostgreCachePolicy >
◆ ~PostgreCache()
template<typename PostgreCachePolicy >
◆ Clear()
◆ Emplace()
template<typename T >
template<typename... Args>
◆ Get()
- Returns
- cache contents. May be
nullptr
if and only if MayReturnNull returns true
.
- Exceptions
-
cache::EmptyCacheError | if the contents are nullptr , and MayReturnNull returns false (which is the default behavior). |
Definition at line 254 of file caching_component_base.hpp.
◆ GetComponentHealth()
|
inlineoverridevirtualinherited |
◆ GetEventChannel()
◆ GetStaticConfigSchema()
template<typename PostgreCachePolicy >
◆ GetUnsafe()
◆ InvalidateAsync()
void cache::CacheUpdateTrait::InvalidateAsync |
( |
UpdateType | update_type | ) |
|
|
inherited |
Non-blocking forced cache update of specified type.
- See also
- PeriodicTask::ForceStepAsync for behavior details
◆ Name()
const std::string & cache::CacheUpdateTrait::Name |
( |
| ) |
const |
|
inherited |
- Returns
- name of the component
◆ OnAllComponentsAreStopping()
void components::ComponentBase::OnAllComponentsAreStopping |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnCacheModified()
void cache::CacheUpdateTrait::OnCacheModified |
( |
| ) |
|
|
protectedinherited |
◆ OnLoadingCancelled()
void components::ComponentBase::OnLoadingCancelled |
( |
| ) |
|
|
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.
◆ PreAssignCheck()
template<typename T >
|
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.
- Note
- old_value_ptr and new_value_ptr can be nullptr.
Definition at line 393 of file caching_component_base.hpp.
◆ ReadContents()
template<typename T >
|
protectedvirtualinherited |
◆ Set() [1/2]
◆ Set() [2/2]
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 300 of file caching_component_base.hpp.
◆ StopPeriodicUpdates()
void cache::CacheUpdateTrait::StopPeriodicUpdates |
( |
| ) |
|
|
protectedinherited |
Stops periodic updates.
- Warning
- Should be called in destructor of derived class.
◆ UpdateAndListen()
template<typename T >
template<typename Class >
Subscribes to cache updates using a member function. Also immediately invokes the function with the current cache contents.
Definition at line 264 of file caching_component_base.hpp.
◆ UpdateSyncDebug()
void cache::CacheUpdateTrait::UpdateSyncDebug |
( |
UpdateType | update_type | ) |
|
|
inherited |
Forces a cache update of specified type.
- Exceptions
-
◆ WriteContents()
template<typename T >
|
protectedvirtualinherited |
◆ kClusterHostTypeFlags
template<typename PostgreCachePolicy >
constexpr auto components::PostgreCache< PostgreCachePolicy >::kClusterHostTypeFlags = pg_cache::detail::ClusterHostType<PolicyType>() |
|
staticconstexpr |
◆ kIncrementalUpdates
template<typename PostgreCachePolicy >
constexpr bool components::PostgreCache< PostgreCachePolicy >::kIncrementalUpdates = pg_cache::detail::kWantIncrementalUpdates<PolicyType> |
|
staticconstexpr |
◆ kName
template<typename PostgreCachePolicy >
The documentation for this class was generated from the following file: