PhoenixmlDb.Core

SchemaCache

Keeps compiled schemas, so that a schema is compiled once and used until one of its documents changes.

#SchemaCache

Namespace: PhoenixmlDb.Core.Schema

Keeps compiled schemas, so that a schema is compiled once and used until one of its documents changes.

A schema is found by its roots, the identity of the gate and the compile limits. It is out of date when any document of its closure has another version than the one compiled, not only a root: a supplied SchemaSource is compared by the version it carries, and any other document by asking the gate (ISchemaAccessGate.GetVersionAsync).

A gate is only given a schema it admits. Before a cached schema goes to a request, that request's own gate is asked about every document of it that no source of the request supplies. If it refuses one, the request compiles for itself, through that gate, and so fails as it would have with no cache. The answer holds for that gate object for one check interval. Two gates that report the same ISchemaAccessGate.Identity therefore share compiled schemas only as far as each of them admits the documents.

Requests that arrive together for the same schema compile it once. A compilation that fails is not kept.

#Constructors

##ctor(PhoenixmlDb.Core.Schema.SchemaCacheOptions)

Makes a cache.

Exceptions:

#Properties

Name Description
Count How many compiled schemas the cache holds.
Default The cache the engines share. A host that wants its own keeps its own instance.

#Methods

#Clear

Forgets every compiled schema.

#ExamineAsync(PhoenixmlDb.Core.Schema.SchemaCache.Entry,PhoenixmlDb.Core.Schema.ISchemaAccessGate,PhoenixmlDb.Core.Schema.SchemaSource[],Threading.CancellationToken)

Whether the entry is current, and whether this gate admits it.

#Get(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions)

for a caller that cannot wait asynchronously; it blocks the calling thread, so it is for hosts whose gate and sources answer at once or that may block a thread.

#GetAsync(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions,Threading.CancellationToken)

The compiled schema for

: the cached one when it is still current and

admits it, otherwise a new compilation.

#Invalidate(Uri)

Forgets every compiled schema that has the document

anywhere in its closure. A host calls this when it knows a document has changed, been replaced or been removed, and does not want to wait for the next check.

#Trim

Drops the least recently used schemas over the limit.