Table of Contents

Class AbstractDocBodyCache<K, TDoc>

Namespace
Tlabs.Data.Repo.Intern
Assembly
Tlabs.Data.dll

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 IDocProcessorRepo
docRepo IRepo<TDoc>

Properties

DocProcessorRepo

public IDocProcessorRepo DocProcessorRepo { get; }

Property Value

IDocProcessorRepo

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

object

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 (using DocProcessorRepo.GetDocumentProcessorBySid(...))).

Methods

ConvertBodyObj(object)

Convert doc into body object.

protected virtual object ConvertBodyObj(object doc)

Parameters

doc object

Returns

object

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

bool

Remarks

Default implementation is loading all documents of DocRepo.