Base class for periodically updated caches. More...
#include <userver/cache/cache_update_trait.hpp>
 Inheritance diagram for cache::CacheUpdateTrait:Public Member Functions | |
| CacheUpdateTrait (CacheUpdateTrait &&)=delete | |
| CacheUpdateTrait & | operator= (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 | 
Protected Types | |
| enum class | Flag {  kNone = 0 , kNoFirstUpdate = 1 << 0 }  | 
| Periodic update flags.  More... | |
Protected Member Functions | |
| 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 () | 
| virtual void | Update (UpdateType type, const std::chrono::system_clock::time_point &last_update, const std::chrono::system_clock::time_point &now, UpdateStatisticsScope &stats_scope)=0 | 
| Should be overridden in a derived class to align the stored data with some data source.   | |
Base class for periodically updated caches.
Definition at line 30 of file cache_update_trait.hpp.
      
  | 
  strongprotected | 
Periodic update flags.
| Enumerator | |
|---|---|
| kNoFirstUpdate | Disable initial update on start.  | 
Definition at line 62 of file cache_update_trait.hpp.
| void cache::CacheUpdateTrait::InvalidateAsync | ( | UpdateType | update_type | ) | 
Non-blocking forced cache update of specified type.
| const std::string & cache::CacheUpdateTrait::Name | ( | ) | const | 
      
  | 
  protected | 
Called in CachingComponentBase::Set during update to indicate that the cached data has been modified 
      
  | 
  protected | 
Stops periodic updates.
      
  | 
  protectedpure virtual | 
Should be overridden in a derived class to align the stored data with some data source.
Update implementation should do one of the following:
A. If the update succeeded and has changes...
| type | type of the update | 
| last_update | time of the last update (value of now from previous invocation of Update or default constructed value if this is the first Update).  | 
| now | current time point | 
| std::exception | on update failure | 
Implemented in components::DynamicConfigClientUpdater.
| void cache::CacheUpdateTrait::UpdateSyncDebug | ( | UpdateType | update_type | ) | 
Forces a cache update of specified type.
| If | Update throws  |