Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
1.0 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Squidex.Caching;
using Squidex.Infrastructure;
namespace Squidex.Web.Pipeline
{
public sealed class LocalCacheMiddleware : IMiddleware
{
private readonly ILocalCache localCache;
public LocalCacheMiddleware(ILocalCache localCache)
{
Guard.NotNull(localCache, nameof(localCache));
this.localCache = localCache;
}
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
using (localCache.StartContext())
{
await next(context);
}
}
}
}