Search Results for

    Show / Hide Table of Contents

    Intent.AspNetCore.DistributedCaching

    This module enables support for distributed caching for an application through the IDistributedCache and IDistributedCacheWithUnitOfWork interfaces. A distributed cache is a cache shared by multiple app servers, typically maintained as an external service to the app servers that access it.

    Settings

    Screenshot of settings for the module

    Provider

    Used to select the implementation to be registered for IDistributedCache, at present the following options are available:

    • Memory
    • Stack Exchange Redis

    Please log on issue on our Github Support should you require a different provider.

    The IDistributedCacheWithUnitOfWork interface

    This interface can be used when mutations to the underlying IDistributedCache should not be persisted until the SaveAllChangesAsync() method on it is used. This would be used in cases where you only want to persist data after all other work, including persistence to a database, has been completed, for scenarios like preventing the cache being mutated prior to an attempt to save to the database which fails.

    The IDistributedCacheWithUnitOfWork interface is registered as a singleton to allow it to be used by other singletons, but uses AsyncLocal<T> to allow isolation when used by different services and scopes.

    IDistributedCacheWithUnitOfWork does not enable unit of work unless its EnableUnitOfWork() is used. EnableUnitOfWork() returns an IDisposable which must be used to release AsyncLocal<T> values.

    The DistributedCacheExtensions class

    These extension methods add convenient methods for JSON serializing into and out of DistributedCache.

    • Edit this page
    ☀
    ☾
    In this article
    Back to top Copyright © 2017-, Intent Software Pte Ltd.