Class ConfigurationBuilderCachePart
Used to build a CacheManagerConfiguration
.
Inherited Members
Namespace:CacheManager.Core
Assembly:CacheManager.Core.dll
Syntax
public class ConfigurationBuilderCachePart
Methods
| Improve this Doc View SourceBuild()
Hands back the new CacheManagerConfiguration instance.
Declaration
public ICacheManagerConfiguration Build()
Returns
Type | Description |
---|---|
ICacheManagerConfiguration |
WithBackplane(Type, String, Object[])
Configures the backplane for the cache manager.
This is an optional feature. If specified, see the documentation for the backplaneType. The configurationKey might be used to reference another configuration item.
If a backplane is defined, at least one cache handle must be marked as backplane source. The cache manager then will try to synchronize multiple instances of the same configuration.
Declaration
public ConfigurationBuilderCachePart WithBackplane(Type backplaneType, string configurationKey, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | backplaneType | The type of the backplane implementation. |
String | configurationKey | The name. |
Object[] | args | Additional arguments the type might need to get initialized. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If configurationKey is null. |
WithBackplane(Type, String, String, Object[])
Configures the backplane for the cache manager.
This is an optional feature. If specified, see the documentation for the backplaneType. The configurationKey might be used to reference another configuration item.
If a backplane is defined, at least one cache handle must be marked as backplane source. The cache manager then will try to synchronize multiple instances of the same configuration.
Declaration
public ConfigurationBuilderCachePart WithBackplane(Type backplaneType, string configurationKey, string channelName, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | backplaneType | The type of the backplane implementation. |
String | configurationKey | The configuration key. |
String | channelName | The backplane channel name. |
Object[] | args | Additional arguments the type might need to get initialized. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If configurationKey or channelName is null. |
WithBinarySerializer()
Configures a BinaryCacheSerializer to be used for serialization and deserialization.
Declaration
public ConfigurationBuilderCachePart WithBinarySerializer()
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder part. |
WithBinarySerializer(BinaryFormatter, BinaryFormatter)
Configures a BinaryCacheSerializer to be used for serialization and deserialization.
Declaration
public ConfigurationBuilderCachePart WithBinarySerializer(BinaryFormatter serializationFormatter, BinaryFormatter deserializationFormatter)
Parameters
Type | Name | Description |
---|---|---|
BinaryFormatter | serializationFormatter | The BinaryFormatter for serialization. |
BinaryFormatter | deserializationFormatter | The BinaryFormatter for deserialization. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder part. |
WithDictionaryHandle(Boolean)
Adds a cache dictionary cache handle to the cache manager.
Declaration
public ConfigurationBuilderCacheHandlePart WithDictionaryHandle(bool isBackplaneSource = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isBackplaneSource | Set this to true if this cache handle should be the source of the backplane. This setting will be ignored if no backplane is configured. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCacheHandlePart | The builder part. |
WithDictionaryHandle(String, Boolean)
Adds a cache dictionary cache handle to the cache manager.
Declaration
public ConfigurationBuilderCacheHandlePart WithDictionaryHandle(string handleName, bool isBackplaneSource = false)
Parameters
Type | Name | Description |
---|---|---|
String | handleName | The name of the cache handle. |
Boolean | isBackplaneSource | Set this to true if this cache handle should be the source of the backplane. This setting will be ignored if no backplane is configured. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCacheHandlePart | The builder part. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if handleName is null. |
WithHandle(Type)
Adds a cache handle with the given Type
.
The type must be an open generic.
Declaration
public ConfigurationBuilderCacheHandlePart WithHandle(Type cacheHandleBaseType)
Parameters
Type | Name | Description |
---|---|---|
Type | cacheHandleBaseType | The cache handle type. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCacheHandlePart | The builder part. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if handleName or cacheHandleBaseType are null. |
WithHandle(Type, String)
Adds a cache handle with the given Type
and name.
The type must be an open generic.
Declaration
public ConfigurationBuilderCacheHandlePart WithHandle(Type cacheHandleBaseType, string handleName)
Parameters
Type | Name | Description |
---|---|---|
Type | cacheHandleBaseType | The cache handle type. |
String | handleName | The name to be used for the cache handle. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCacheHandlePart | The builder part. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if handleName or cacheHandleBaseType are null. |
WithHandle(Type, String, Boolean, Object[])
Adds a cache handle with the given Type
and name.
The type must be an open generic.
Declaration
public ConfigurationBuilderCacheHandlePart WithHandle(Type cacheHandleBaseType, string handleName, bool isBackplaneSource, params object[] configurationTypes)
Parameters
Type | Name | Description |
---|---|---|
Type | cacheHandleBaseType | The cache handle type. |
String | handleName | The name to be used for the cache handle. |
Boolean | isBackplaneSource | Set this to true if this cache handle should be the source of the backplane. This setting will be ignored if no backplane is configured. |
Object[] | configurationTypes | Internally used only. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCacheHandlePart | The builder part. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If handleName is null. |
InvalidOperationException | Only one cache handle can be the backplane's source. |
ArgumentNullException | Thrown if handleName or cacheHandleBaseType are null. |
WithLogging(Type, Object[])
Enables logging by setting the ILoggerFactory for the cache manager instance.
Declaration
public ConfigurationBuilderCachePart WithLogging(Type loggerFactoryType, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | loggerFactoryType | The type of the logger factory. |
Object[] | args | Additional arguments the type might need to get initialized. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder part. |
WithMaxRetries(Int32)
Sets the maximum number of retries per action.
Default is 50.
Not every cache handle implements this, usually only distributed caches will use it.
Declaration
public ConfigurationBuilderCachePart WithMaxRetries(int retries)
Parameters
Type | Name | Description |
---|---|---|
Int32 | retries | The maximum number of retries. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The configuration builder. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Maximum number of retries must be greater than 0. |
WithRetryTimeout(Int32)
Sets the timeout between each retry of an action in milliseconds.
Default is 100.
Not every cache handle implements this, usually only distributed caches will use it.
Declaration
public ConfigurationBuilderCachePart WithRetryTimeout(int timeoutMillis)
Parameters
Type | Name | Description |
---|---|---|
Int32 | timeoutMillis | The timeout in milliseconds. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The configuration builder. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Retry timeout must be greater than or equal to zero. |
WithSerializer(Type, Object[])
Sets the serializer which should be used to serialize cache items.
Declaration
public ConfigurationBuilderCachePart WithSerializer(Type serializerType, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | serializerType | The type of the serializer. |
Object[] | args | Additional arguments the type might need to get initialized. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder part. |
WithUpdateMode(CacheUpdateMode)
Sets the update mode of the cache.
If nothing is set, the default will be CacheUpdateMode.None
.
Declaration
public ConfigurationBuilderCachePart WithUpdateMode(CacheUpdateMode updateMode)
Parameters
Type | Name | Description |
---|---|---|
CacheUpdateMode | updateMode | The update mode. |
Returns
Type | Description |
---|---|
ConfigurationBuilderCachePart | The builder part. |