CQRS.NET  4.0
A lightweight enterprise Function as a Service (FaaS) framework to write function based serverless and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.
Cqrs.Cache.CacheRepository< TAuthenticationToken > Class Template Reference

Uses MemoryCache.Default to provide a caching mechanism to improve performance of a IAggregateRepository<TAuthenticationToken>. More...

+ Inheritance diagram for Cqrs.Cache.CacheRepository< TAuthenticationToken >:

Public Member Functions

 CacheRepository (IAggregateRepository< TAuthenticationToken > repository, IEventStore< TAuthenticationToken > eventStore)
 Instantiates a new instance of CacheRepository<TAuthenticationToken>. More...
 
virtual void Save< TAggregateRoot > (TAggregateRoot aggregate, int? expectedVersion=null)
 Locks the cache, adds the provided aggregate to the cache if not already in it, then calls IAggregateRepository<TAuthenticationToken>.Save<TAggregateRoot> on Repository. In the event of an Exception the aggregate is always ejected out of the Cache. More...
 
virtual TAggregateRoot Get< TAggregateRoot > (Guid aggregateId, IList< IEvent< TAuthenticationToken >> events=null)
 Locks the cache, checks if the aggregate is tracked in the Cache, if it is retrieves the aggregate from the Cache and then uses either the provided events or makes a call IEventStore<TAuthenticationToken>.Get(System.Type,System.Guid,bool,int) on the EventStore and rehydrates the cached aggregate with any new events from it's cached version. If the aggregate is not in the Cache IAggregateRepository<TAuthenticationToken>.Get<TAggregateRoot> is called on the Repository. More...
 
TAggregateRoot GetToVersion< TAggregateRoot > (Guid aggregateId, int version, IList< IEvent< TAuthenticationToken >> events=null)
 Retrieves an IAggregateRoot<TAuthenticationToken> of type TAggregateRoot up to and including the provided version . More...
 
TAggregateRoot GetToDate< TAggregateRoot > (Guid aggregateId, DateTime versionedDate, IList< IEvent< TAuthenticationToken >> events=null)
 Retrieves an IAggregateRoot<TAuthenticationToken> of type TAggregateRoot up to and including the provided versionedDate . More...
 

Detailed Description

Uses MemoryCache.Default to provide a caching mechanism to improve performance of a IAggregateRepository<TAuthenticationToken>.

Template Parameters
TAuthenticationTokenThe Type of authentication token.