Table of Contents

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

builder IAkavacheInstance

The builder.

cacheName string

Name 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

builder IAkavacheInstance

The builder.

cacheName string

Name 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.

public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Action<IAkavacheBuilder> configure, string? applicationName = null) where T : ISerializer, new()

Parameters

builder IAppBuilder

The Splat application builder to configure.

configure Action<IAkavacheBuilder>

An action to configure the Akavache builder settings.

applicationName string

The name of the application for cache directory paths.

Returns

IAppBuilder

The configured Splat application builder for method chaining.

Type Parameters

T

The type of serializer to use for cache operations.

Exceptions

ArgumentNullException

Thrown when builder is null.

WithAkavacheCacheDatabase<T>(IAppBuilder, Func<T>, Action<IAkavacheBuilder>, string?)

Initializes the CacheDatabase with a custom serializer configuration and builder settings.

public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Func<T> configureSerializer, Action<IAkavacheBuilder> configure, string? applicationName = null) where T : ISerializer, new()

Parameters

builder IAppBuilder

The Splat application builder to configure.

configureSerializer Func<T>

A function that creates and configures the serializer instance.

configure Action<IAkavacheBuilder>

An action to configure the Akavache builder settings.

applicationName string

The name of the application for cache directory paths.

Returns

IAppBuilder

The configured Splat application builder for method chaining.

Type Parameters

T

The type of serializer to use for cache operations.

Exceptions

ArgumentNullException

Thrown when builder is 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.

public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, Func<T> configureSerializer, string? applicationName = null) where T : ISerializer, new()

Parameters

builder IAppBuilder

The Splat application builder to configure.

configureSerializer Func<T>

A function that creates and configures the serializer instance.

applicationName string

The 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

T

The type of serializer to use for cache operations.

Exceptions

ArgumentNullException

Thrown when builder is 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.

public static IAppBuilder WithAkavacheCacheDatabase<T>(this IAppBuilder builder, string? applicationName = null) where T : ISerializer, new()

Parameters

builder IAppBuilder

The Splat application builder to configure.

applicationName string

The 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

T

The type of serializer to use for cache operations.

Exceptions

ArgumentNullException

Thrown when builder is null.

WithAkavache<T>(IAppBuilder, string?, Action<IAkavacheBuilder>, Action<IAkavacheInstance>)

Initializes CacheDatabase with a custom builder configuration.

public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheBuilder> configure, Action<IAkavacheInstance> instance) where T : ISerializer, new()

Parameters

builder IAppBuilder

The builder.

applicationName string

Name of the application.

configure Action<IAkavacheBuilder>

An action to configure the CacheDatabase builder.

instance Action<IAkavacheInstance>

The instance.

Returns

IAppBuilder

The configured builder.

Type Parameters

T

The 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.

public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheBuilder> configure, Action<IMutableDependencyResolver, IAkavacheInstance> instance) where T : ISerializer, new()

Parameters

builder IAppBuilder

The builder.

applicationName string

Name of the application.

configure Action<IAkavacheBuilder>

An action to configure the CacheDatabase builder.

instance Action<IMutableDependencyResolver, IAkavacheInstance>

The instance.

Returns

IAppBuilder

The configured builder.

Type Parameters

T

The 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.

public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IAkavacheInstance> instance) where T : ISerializer, new()

Parameters

builder IAppBuilder

The builder.

applicationName string

The application name for cache directories. If null, uses the current ApplicationName.

instance Action<IAkavacheInstance>

The instance created.

Returns

IAppBuilder

A BlobCache builder for further configuration.

Type Parameters

T

The 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.

public static IAppBuilder WithAkavache<T>(this IAppBuilder builder, string? applicationName, Action<IMutableDependencyResolver, IAkavacheInstance> instance) where T : ISerializer, new()

Parameters

builder IAppBuilder

The builder.

applicationName string

The application name for cache directories. If null, uses the current ApplicationName.

instance Action<IMutableDependencyResolver, IAkavacheInstance>

The instance created.

Returns

IAppBuilder

A BlobCache builder for further configuration.

Type Parameters

T

The type of Serializer.

Exceptions

ArgumentNullException

builder.

WithInMemory(IAkavacheBuilder)

Withes the in memory.

public static IAkavacheBuilder WithInMemory(this IAkavacheBuilder builder)

Parameters

builder IAkavacheBuilder

The builder.

Returns

IAkavacheBuilder

The builder instance for fluent configuration.

Exceptions

ArgumentNullException

builder.