Class AbstractDocBodyCache<K, TDoc>
Abstract document Cache.
public abstract class AbstractDocBodyCache<K, TDoc> : IDocBodyCache<K, TDoc> where K : notnull where TDoc : BaseDocument<TDoc>
Type Parameters
K
TDoc
- Inheritance
-
AbstractDocBodyCache<K, TDoc>
- Implements
-
IDocBodyCache<K, TDoc>
- Inherited Members
- Extension Methods
Constructors
AbstractDocBodyCache(IObjectCache<K, TDoc>, IDocProcessorRepo, IRepo<TDoc>)
Ctor from cache
, docProcRepo
and docRepo
.
public AbstractDocBodyCache(IObjectCache<K, TDoc> cache, IDocProcessorRepo docProcRepo, IRepo<TDoc> docRepo)
Parameters
cache
IObjectCache<K, TDoc>docProcRepo
IDocProcessorRepodocRepo
IRepo<TDoc>
Properties
DocProcessorRepo
public IDocProcessorRepo DocProcessorRepo { get; }
Property Value
DocRepo
Document IRepo<TEntity>.
public IRepo<TDoc> DocRepo { get; }
Property Value
- IRepo<TDoc>
this[TDoc]
Gets or sets a document body object from the cache with specified tmplDoc
as key.
public object? this[TDoc tmplDoc] { get; set; }
Parameters
tmplDoc
TDoc
Property Value
Remarks
- Setting a value of null evicts any entry with key from the cache.
- Setting a value of of
TDoc
converts the document into its body object (usingDocProcessorRepo.GetDocumentProcessorBySid(...))
).
Methods
ConvertBodyObj(object)
Convert doc
into body object.
protected virtual object ConvertBodyObj(object doc)
Parameters
doc
object
Returns
ObtainMissingDocument(TDoc)
Obtain a TDoc
not contained in cache from tmplObj
.
protected abstract TDoc ObtainMissingDocument(TDoc tmplObj)
Parameters
tmplObj
TDoc
Returns
- TDoc
Remarks
If implementation returns null, null is returned from the cache indexer.
WarmUp()
Perform cache warm-up.
public virtual bool WarmUp()
Returns
Remarks
Default implementation is loading all documents of DocRepo.