Class SqlCache
See Documentation how to create a database here: https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-3.0
[Export("Sql", typeof(ICache))]
public class SqlCache : BaseDistributeCache<SqlCache>, ICache, IDisposable
- Inheritance
-
SqlCache
- Implements
- Inherited Members
Constructors
SqlCache(ILogger<SqlCache>, IServiceProvider, IOptionsMonitor<SqlCacheOption>)
Initializes a new instance of the SqlCache class.
public SqlCache(ILogger<SqlCache> logger, IServiceProvider container, IOptionsMonitor<SqlCacheOption> options)
Parameters
loggerILogger<SqlCache>The logger.
containerIServiceProviderThe service provider used to resolve the serializer.
optionsIOptionsMonitor<SqlCacheOption>The named options of the SQL caches.
Methods
Initialize(string)
Creates the underlying SQL Server cache from the options named store and resolves the IObjectSerialization
(the one registered with SerializerName if any, otherwise the default one).
When no serializer can be resolved the cache stays uninitialized and the operations throw CacheNotInitializedException.
Calling it again on an initialized cache only logs a warning.
public override void Initialize(string store)
Parameters
storestringThe name of the cache, as declared in the configuration.
Exceptions
- ArgumentException
storeis empty.
ToString()
Returns the name of the cache given to Initialize(string).
public override string ToString()
Returns
- string
The name of the cache.
Exceptions
- InvalidOperationException
The cache has not been initialized.