Class SiteOptionsCache<TOptions>
- Namespace
- Oqtane.Infrastructure
- Assembly
- Oqtane.Server.dll
public class SiteOptionsCache<TOptions> where TOptions : class, new()
Type Parameters
TOptions
- Inheritance
-
objectSiteOptionsCache<TOptions>
Constructors
SiteOptionsCache(IAliasAccessor)
public SiteOptionsCache(IAliasAccessor aliasAccessor)
Parameters
aliasAccessor
IAliasAccessor
Methods
Clear()
Clears all options instances from the cache.
public void Clear()
GetOrAdd(string, Func<TOptions>)
Gets a named options instance, or adds a new instance created with createOptions
.
public TOptions GetOrAdd(string name, Func<TOptions> createOptions)
Parameters
name
stringThe name of the options instance.
createOptions
Func<TOptions>The func used to create the new instance.
Returns
- TOptions
The options instance.
TryAdd(string, TOptions)
Tries to adds a new option to the cache, will return false if the name already exists.
public bool TryAdd(string name, TOptions options)
Parameters
name
stringThe name of the options instance.
options
TOptionsThe options instance.
Returns
- bool
Whether anything was added.
TryRemove(string)
Try to remove an options instance.
public bool TryRemove(string name)
Parameters
name
stringThe name of the options instance.
Returns
- bool
Whether anything was removed.