using Umbraco.Cms.Core.Cache;
namespace Umbraco.Cms.Core.Models.PublishedContent
{
///
/// Implements on top of .
///
public class HttpContextVariationContextAccessor : IVariationContextAccessor
{
private readonly IRequestCache _requestCache;
private const string ContextKey = "Umbraco.Web.Models.PublishedContent.DefaultVariationContextAccessor";
///
/// Initializes a new instance of the class.
///
public HttpContextVariationContextAccessor(IRequestCache requestCache) => _requestCache = requestCache;
///
public VariationContext? VariationContext
{
get => (VariationContext?) _requestCache.Get(ContextKey);
set => _requestCache.Set(ContextKey, value);
}
}
}