#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 435 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.
|
| |
| void | Attach (const std::shared_ptr< const T > &value_ptr) |
| |
| 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 | OnCacheModified () |
| |
|
virtual utils::Flags< Flag > | GetStartFlags () const |
| | Returns flags for cache start.
|
| |
|
void | EarlyStartPeriodicUpdates (utils::Flags< Flag > flags) |
| | Call this to start periodic updates just now, not after the constuctor.
|
| |
|
| 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 >
◆ Attach()
Attach the value of cache. As a result the Get() member function starts returning the value passed into this function after the Update() finishes. Does not take over into sole ownership. Do not use unless absolutely necessary. The object must be strictly thread-safe.
- Warning
- Do not forget to update cache::UpdateStatisticsScope, otherwise the behavior is undefined.
Definition at line 288 of file caching_component_base.hpp.
◆ Clear()
◆ Emplace()
template<typename T >
template<typename... Args>
◆ Get()
◆ 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 |
◆ OnAllComponentsLoaded()
| void components::ComponentBase::OnAllComponentsLoaded |
( |
| ) |
|
|
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 385 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 283 of file caching_component_base.hpp.
◆ 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 260 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: