Class AkavacheBuilderExtensions
- Namespace
- Akavache
- Assembly
- Akavache.dll
Provides extension methods for configuring Akavache cache database with Splat application builders.
public static class AkavacheBuilderExtensions
- Inheritance
-
AkavacheBuilderExtensions
Methods
GetIsolatedCacheDirectory(IAkavacheInstance, string)
Gets the isolated cache directory.
public static string? GetIsolatedCacheDirectory(this IAkavacheInstance builder, string cacheName)
Parameters
builderIAkavacheInstanceThe builder.
cacheNamestringName of the cache. This will determine the file store to use. LocalMachine will use Machine Store For Assembly. UserAccount will use User Store For Assembly. Secure will use User Store For Assembly. SettingsCache will use User Store For Assembly. Any other value will use Machine Store For Assembly.
Returns
- string
The Isolated cache path.
Exceptions
- ArgumentNullException
builder.
- ArgumentException
Cache name cannot be null or empty. - cacheName or Application name cannot be null or empty. - ApplicationName.
GetLegacyCacheDirectory(IAkavacheInstance, string)
Gets the legacy cache directory.
public static string? GetLegacyCacheDirectory(this IAkavacheInstance builder, string cacheName)
Parameters
builderIAkavacheInstanceThe builder.
cacheNamestringName of the cache.
Returns
- string
The Legacy cache path.
Exceptions
- ArgumentNullException
builder.
- ArgumentException
Cache name cannot be null or empty. - cacheName or Application name cannot be null or empty. - ApplicationName.
WithAkavacheCacheDatabase<T>(IAppBuilder, Action<IAkavacheBuilder>, string?)
Initializes the CacheDatabase with a custom builder configuration for the specified application.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Action<IAkavacheBuilder> configure, string? applicationName = null) where T : ISerializer, new()
Parameters
builderIAppBuilderThe Splat application builder to configure.
configureAction<IAkavacheBuilder>An action to configure the Akavache builder settings.
applicationNamestringThe name of the application for cache directory paths.
Returns
- IAppBuilder
The configured Splat application builder for method chaining.
Type Parameters
TThe type of serializer to use for cache operations.
Exceptions
- ArgumentNullException
Thrown when
builderis null.
WithAkavacheCacheDatabase<T>(IAppBuilder, Func<T>, Action<IAkavacheBuilder>, string?)
Initializes the CacheDatabase with a custom serializer configuration and builder settings.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Func<T> configureSerializer, Action<IAkavacheBuilder> configure, string? applicationName = null) where T : ISerializer, new()
Parameters
builderIAppBuilderThe Splat application builder to configure.
configureSerializerFunc<T>A function that creates and configures the serializer instance.
configureAction<IAkavacheBuilder>An action to configure the Akavache builder settings.
applicationNamestringThe name of the application for cache directory paths.
Returns
- IAppBuilder
The configured Splat application builder for method chaining.
Type Parameters
TThe type of serializer to use for cache operations.
Exceptions
- ArgumentNullException
Thrown when
builderis null.
WithAkavacheCacheDatabase<T>(IAppBuilder, Func<T>, string?)
Initializes the CacheDatabase with default in-memory caches and a custom serializer configuration. This is a safe default configuration that does not require any additional packages.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Func<T> configureSerializer, string? applicationName = null) where T : ISerializer, new()
Parameters
builderIAppBuilderThe Splat application builder to configure.
configureSerializerFunc<T>A function that creates and configures the serializer instance.
applicationNamestringThe name of the application for cache directory paths. If null, uses the current ApplicationName.
Returns
- IAppBuilder
The configured Splat application builder for method chaining.
Type Parameters
TThe type of serializer to use for cache operations.
Exceptions
- ArgumentNullException
Thrown when
builderis null.
WithAkavacheCacheDatabase<T>(IAppBuilder, string?)
Initializes the CacheDatabase with default in-memory caches. This is the safest default configuration as it does not require any additional packages.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, string? applicationName = null) where T : ISerializer, new()
Parameters
builderIAppBuilderThe Splat application builder to configure.
applicationNamestringThe name of the application for cache directory paths. If null, uses the current ApplicationName.
Returns
- IAppBuilder
The configured Splat application builder for method chaining.
Type Parameters
TThe type of serializer to use for cache operations.
Exceptions
- ArgumentNullException
Thrown when
builderis null.
WithAkavache<T>(IAppBuilder, string?, Action<IAkavacheBuilder>, Action<IAkavacheInstance>)
Initializes CacheDatabase with a custom builder configuration.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheBuilder> configure, Action<IAkavacheInstance> instance) where T : ISerializer, new()
Parameters
builderIAppBuilderThe builder.
applicationNamestringName of the application.
configureAction<IAkavacheBuilder>An action to configure the CacheDatabase builder.
instanceAction<IAkavacheInstance>The instance.
Returns
- IAppBuilder
The configured builder.
Type Parameters
TThe type of Serializer.
Exceptions
- ArgumentNullException
builder or configure or instance.
- ArgumentNullException
builder.
WithAkavache<T>(IAppBuilder, string?, Action<IAkavacheBuilder>, Action<IMutableDependencyResolver, IAkavacheInstance>)
Initializes CacheDatabase with a custom builder configuration.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheBuilder> configure, Action<IMutableDependencyResolver, IAkavacheInstance> instance) where T : ISerializer, new()
Parameters
builderIAppBuilderThe builder.
applicationNamestringName of the application.
configureAction<IAkavacheBuilder>An action to configure the CacheDatabase builder.
instanceAction<IMutableDependencyResolver, IAkavacheInstance>The instance.
Returns
- IAppBuilder
The configured builder.
Type Parameters
TThe type of Serializer.
Exceptions
- ArgumentNullException
builder or configure or instance.
- ArgumentNullException
builder.
WithAkavache<T>(IAppBuilder, string?, Action<IAkavacheInstance>)
Initializes CacheDatabase with a set of default in-memory caches. This is the safest default as it doesn't require any additional packages.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheInstance> instance) where T : ISerializer, new()
Parameters
builderIAppBuilderThe builder.
applicationNamestringThe application name for cache directories. If null, uses the current ApplicationName.
instanceAction<IAkavacheInstance>The instance created.
Returns
- IAppBuilder
A BlobCache builder for further configuration.
Type Parameters
TThe type of Serializer.
Exceptions
- ArgumentNullException
builder.
WithAkavache<T>(IAppBuilder, string?, Action<IMutableDependencyResolver, IAkavacheInstance>)
Initializes CacheDatabase with a set of default in-memory caches. This is the safest default as it doesn't require any additional packages.
[RequiresUnreferencedCode("Serializers require types to be preserved for serialization.")]
public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IMutableDependencyResolver, IAkavacheInstance> instance) where T : ISerializer, new()
Parameters
builderIAppBuilderThe builder.
applicationNamestringThe application name for cache directories. If null, uses the current ApplicationName.
instanceAction<IMutableDependencyResolver, IAkavacheInstance>The instance created.
Returns
- IAppBuilder
A BlobCache builder for further configuration.
Type Parameters
TThe type of Serializer.
Exceptions
- ArgumentNullException
builder.
WithInMemory(IAkavacheBuilder)
Withes the in memory.
public static IAkavacheBuilder WithInMemory(this IAkavacheBuilder builder)
Parameters
builderIAkavacheBuilderThe builder.
Returns
- IAkavacheBuilder
The builder instance for fluent configuration.
Exceptions
- ArgumentNullException
builder.