Class CacheReferencedEntitiesSuppression
Provides an ambient, opt-in mechanism to suppress the eager caching of referenced entities performed
by ICacheReferencedEntities implementations while re-running a value editor's
FromEditor pipeline.
Inheritance
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Core.dll
Syntax
[Obsolete("The ICacheReferencedEntities interface is available for support of request caching retrieved entities in property value editors that implement it. The intention is to supersede this with lazy loaded read locks, which will make this unnecessary. When the interface is removed, these extension methods will also be removed. Scheduled for removal in Umbraco 19.")]
public static class CacheReferencedEntitiesSuppression
Remarks
Upgrade migrations re-run FromEditor purely to re-serialize stored property values. The
referenced-entity caching that pipeline performs only benefits the reference tracking of a live save
- which migrations do not perform - so during a migration it is wasted work that issues a
content/media lookup per processed property. Those lookups run in their own scopes (and, for the
parallelized migrations, on separate connections), contending with the migration's own scope.
Wrapping the FromEditor call in Suppress() skips them.
This is a companion to the obsolete ICacheReferencedEntities and is expected to be removed alongside it once referenced entities are loaded via lazy read locks.
Properties
View SourceIsSuppressed
Gets a value indicating whether referenced-entity caching is currently suppressed on the executing context.
Declaration
public static bool IsSuppressed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceSuppress()
Suppresses referenced-entity caching until the returned System.IDisposable is disposed.
Declaration
public static IDisposable Suppress()
Returns
| Type | Description |
|---|---|
| IDisposable | A disposable that restores the previous suppression state when disposed. |