using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Umbraco.Core.Cache
{
///
/// Implements a fast on top of HttpContext.Items.
///
///
/// If no current HttpContext items can be found (no current HttpContext,
/// or no Items...) then this cache acts as a pass-through and does not cache
/// anything.
///
internal class HttpRequestAppCache : FastDictionaryAppCacheBase
{
private readonly HttpContextBase _context;
///
/// Initializes a new instance of the class with a context, for unit tests!
///
public HttpRequestAppCache(HttpContextBase context)
{
_context = context;
}
///
/// Initializes a new instance of the class.
///
///
/// Will use HttpContext.Current.
/// fixme/task: use IHttpContextAccessor NOT HttpContext.Current
///
public HttpRequestAppCache()
{ }
private IDictionary ContextItems => _context?.Items ?? HttpContext.Current?.Items;
private bool HasContextItems => _context?.Items != null || HttpContext.Current != null;
///
public override object Get(string key, Func