Class NCacheConfiguration
This class is used to configure NCache for caching Entity Framework query result sets.
Inheritance
Assembly: Alachisoft.NCache.EntityFrameworkCore.dll
Syntax
public class NCacheConfiguration : object
Properties
BulkInsertChunkSize
Specifies the chunk size for bulk item insertion. The default chunk size is 1000.
Declaration
public static int BulkInsertChunkSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Chunk size for bulk item insertion. |
CacheId
Specifies the cache name in which your result sets will be stored.
Declaration
public static string CacheId { get; }
Property Value
Type | Description |
---|---|
System.String | Name of the cache. |
DatabaseType
This option specifies which database dependency should be created.
Declaration
public static DependencyType DatabaseType { get; }
Property Value
Type | Description |
---|---|
Alachisoft.NCache.EntityFrameworkCore.DependencyType | Type of database dependency. |
InitParams
Used to initialize NCache and override the default NCache parameters.
Declaration
public static CacheConnectionOptions InitParams { get; }
Property Value
Type | Description |
---|---|
CacheConnectionOptions | Initialization parameters. |
IsConfigured
This flag specifies whether provider has been configured or not.
Declaration
public static bool IsConfigured { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Returns the values True or False. True corresponds to the provider being configured and false corresponds otherwise. |
IsErrorEnabled
This flag specifies whether the exception will be thrown or not. True value corresponds to throw the exception and False corresponds to otherwise.
Declaration
public static bool IsErrorEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Returns the values True or False. True corresponds to the provider being configured and False corresponds otherwise. |
Methods
Configure(String, DependencyType, CacheConnectionOptions, Boolean, Int32)
Configures NCache for caching Entity Framework query result sets.
Declaration
public static void Configure(string cacheId, DependencyType databaseType, CacheConnectionOptions initParams, bool errorEnabled = false, int bulkInsertChunkSize = 1000)
Parameters
Type | Name | Description |
---|---|---|
System.String | cacheId | Cache Id that will be used to store result sets. |
Alachisoft.NCache.EntityFrameworkCore.DependencyType | databaseType | Database type that will be used when creating database dependencies. |
CacheConnectionOptions | initParams | Additional parameters used to initialize NCache. |
System.Boolean | errorEnabled | Specifies if exceptions should be thrown for FromCache and LoadIntoCache queries. |
System.Int32 | bulkInsertChunkSize | Specifies the chunk size for bulk insertion. |
Configure(String, DependencyType, Boolean, Int32)
Configures NCache for caching Entity Framework query result sets.
Declaration
public static void Configure(string cacheId, DependencyType databaseType, bool errorEnabled = false, int bulkInsertChunkSize = 1000)
Parameters
Type | Name | Description |
---|---|---|
System.String | cacheId | Cache Id that will be used to store result sets. |
Alachisoft.NCache.EntityFrameworkCore.DependencyType | databaseType | Database type that will be used when creating database dependencies. |
System.Boolean | errorEnabled | Specifies if exceptions should be thrown for FromCache and LoadIntoCache queries. |
System.Int32 | bulkInsertChunkSize | Specifies the chunk size for bulk insertion. |
ConfigureLogger(ILoggerFactory, String, String, Microsoft.Extensions.Logging.LogLevel)
Configures logging for Entity Framework Core provider. By default, the logs are created in NCache's log directory unless specified.
Declaration
public static void ConfigureLogger(ILoggerFactory factory = null, string categoryName = null, string path = null, Microsoft.Extensions.Logging.LogLevel logLevel = null)
Parameters
Type | Name | Description |
---|---|---|
ILoggerFactory | factory | The custom logger factory that will provide the log-levels. |
System.String | categoryName | Specifies the category name of the logger. |
System.String | path | Corresponds to the custom path where a user wants to create the logs, it can be null. |
Microsoft.Extensions.Logging.LogLevel | logLevel | Specifies the level of the event that is to be logged. |
IsLoggerEnabled(Microsoft.Extensions.Logging.LogLevel)
Determine whether any of the configured loggers are currently recording log messages at the specified log levels or not.
Declaration
public static bool IsLoggerEnabled(Microsoft.Extensions.Logging.LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.LogLevel | logLevel | The log level which is to be checked. |
Returns
Type | Description |
---|---|
System.Boolean | Returns True, if logging is available for the specified log level, else returns False. |