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
aliasAccessorIAliasAccessor
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
namestringThe name of the options instance.
createOptionsFunc<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
namestringThe name of the options instance.
optionsTOptionsThe options instance.
Returns
- bool
Whether anything was added.
TryRemove(string)
Try to remove an options instance.
public bool TryRemove(string name)
Parameters
namestringThe name of the options instance.
Returns
- bool
Whether anything was removed.