Skip to content

Provider for caching using ASPNet OutputCache using LiteDatabase.

License

Notifications You must be signed in to change notification settings

JulioBorges/AspNetCore.CacheOutput.LiteDB

Repository files navigation

AspNetCore.CacheOutput.LiteDB

Provider for caching using ASPNet OutputCache using LiteDatabase. Use with a ASP.NET Core port of StratWeb.CacheOutput library

Access our Nuget page

Initial configuration:

  1. Install ASP.NET Core CacheOutput package: Install-Package AspNetCore.CacheOutput

  2. Install core package: Install-Package AspNetCore.CacheOutput.LiteDB

  3. In "Startup" class "ConfigureServices" method:

    • Register cache key generator:

      services.AddSingleton<ICacheKeyGenerator, DefaultCacheKeyGenerator>();
    • Register the provider for LiteDB using default database path:

      services.AddSingleton<IApiOutputCache, InMemoryOutputCacheProvider>();

      OR define database path implicity

      services.AddSingleton<IApiOutputCache, LiteDBOutputCacheProvider>(provider =>
      {
          return new LiteDBOutputCacheProvider("newFile.db");
      });
  4. In "Startup" class "Configure" method initialize cache output:

    app.UseCacheOutput();
  5. Decorate any controller method with cache output filters:

[CacheOutput(ClientTimeSpan = 0, ServerTimeSpan = 3600, MustRevalidate = true, ExcludeQueryStringFromCacheKey = false)]
  1. Read https://github.com/filipw/Strathweb.CacheOutput for more details about common filter usage

About

Provider for caching using ASPNet OutputCache using LiteDatabase.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages