C# Class Flatwhite.Hot.Phoenix

A class contains all the info to create the new fresh cache item when cache is about to expire
Inheritance: IDisposable
Datei anzeigen Open project: vanthoainguyen/Flatwhite Class Usage Examples

Protected Properties

Property Type Description
_info CacheItem
_phoenixState IPhoenixState

Private Properties

Property Type Description
DieAsync Task
GetCacheItem CacheItem
GetCurrentState IPhoenixState
GetTargetInstance object
InvokeAndGetBareResult Task
RebornCallback void

Public Methods

Method Description
Dispose ( ) : void

Dispose the timer and remove it from Global.Cache

Phoenix ( _IInvocation invocation, CacheItem info ) : System

Initialize a phoenix with provided cacheDuration and staleWhileRevalidate values

Reborn ( ) : void

Refresh the cache and change the internal IPhoenixState to avoid refreshing too many unnecessary times

The call will happen in background so the caller will not have to wait

Protected Methods

Method Description
FireAsync ( ) : Task

Rebuild the cache and return the new IPhoenixState

Retry ( System.TimeSpan timeSpan ) : void

Retry phoenix reborn after a timespan

Private Methods

Method Description
DieAsync ( ) : Task
GetCacheItem ( object invocationBareResult ) : CacheItem
GetCurrentState ( ) : IPhoenixState
GetTargetInstance ( ICacheDependencyScope scope ) : object
InvokeAndGetBareResult ( object serviceInstance ) : Task
RebornCallback ( object phoenixId ) : void

Method Details

Dispose() public method

Dispose the timer and remove it from Global.Cache
public Dispose ( ) : void
return void

FireAsync() protected method

Rebuild the cache and return the new IPhoenixState
protected FireAsync ( ) : Task
return Task

Phoenix() public method

Initialize a phoenix with provided cacheDuration and staleWhileRevalidate values
public Phoenix ( _IInvocation invocation, CacheItem info ) : System
invocation _IInvocation
info CacheItem
return System

Reborn() public method

Refresh the cache and change the internal IPhoenixState to avoid refreshing too many unnecessary times

The call will happen in background so the caller will not have to wait

public Reborn ( ) : void
return void

Retry() protected method

Retry phoenix reborn after a timespan
protected Retry ( System.TimeSpan timeSpan ) : void
timeSpan System.TimeSpan
return void

Property Details

_info protected_oe property

Get information about the cache
protected CacheItem _info
return CacheItem

_phoenixState protected_oe property

Phoenix state
protected IPhoenixState _phoenixState
return IPhoenixState