Class CacheAllStreams
- Namespace
- ToSic.Eav.DataSources.Caching
- Assembly
- ToSic.Eav.DataSources.dll
Special DataSource which automatically caches everything it's given.
It's Used to optimize queries, so that heavier calculations don't need to be repeated if another request with the same signature is used.
Internally it asks all up-stream DataSources what factors would determine their caching.
So if part of the supplying DataSources would have a changed parameter (like a different filter), it will still run the full query and cache the results again.
[VisualQuery(NiceName = "Cache Streams", UiHint = "Cache all streams based on some rules", Icon = "history_toggle_off", Type = DataSourceType.Cache, NameId = "ToSic.Eav.DataSources.Caching.CacheAllStreams, ToSic.Eav.DataSources", DynamicOut = true, DynamicIn = true, ConfigurationType = "|Config ToSic.Eav.DataSources.Caches.CacheAllStreams", NameIds = new string[] { "ToSic.Eav.DataSources.Caches.CacheAllStreams, ToSic.Eav.DataSources" }, HelpLink = "https://github.com/2sic/2sxc/wiki/DotNet-DataSource-CacheAllStreams")]
[PublicApi]
public class CacheAllStreams : DataSourceBase, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable
- Inheritance
-
CacheAllStreams
- Implements
- Inherited Members
Remarks
- Changed in v15.05 to use the immutable convention
- note that the above change is actually a breaking change, but since this is such an advanced DataSource, we assume it's not used in dynamic code.
Properties
CacheDurationInSeconds
How long to keep these streams in the cache.
Default is 0
- meaning fall back to 1 day
[Configuration(Fallback = 0)]
public int CacheDurationInSeconds { get; }
Property Value
Out
Gets the Dictionary of Out-Streams. This is the internal accessor, as usually you'll use this["name"] instead.
In rare cases you need the Out, for example to list the stream names in the data source.
public override IReadOnlyDictionary<string, IDataStream> Out { get; }
Property Value
- IReadOnlyDictionary<string, IDataStream>
A dictionary of named IDataStream objects, case insensitive
RefreshOnSourceRefresh
If a source-refresh should trigger a cache rebuild
[Configuration(Fallback = true)]
public bool RefreshOnSourceRefresh { get; }
Property Value
ReturnCacheWhileRefreshing
Perform a cache rebuild async.
[Configuration(Fallback = false)]
public bool ReturnCacheWhileRefreshing { get; }