2019-01-17 11:01:23 +01:00
|
|
|
|
using System;
|
2020-02-13 07:46:49 +01:00
|
|
|
|
using System.Collections;
|
2019-01-17 11:01:23 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Cache
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2019-01-18 07:56:38 +01:00
|
|
|
|
/// Implements <see cref="IAppPolicyCache"/> and do not cache.
|
2019-01-17 11:01:23 +01:00
|
|
|
|
/// </summary>
|
2019-11-27 14:10:48 +01:00
|
|
|
|
public class NoAppCache : IAppPolicyCache, IRequestCache
|
2019-01-17 11:01:23 +01:00
|
|
|
|
{
|
2019-11-27 14:10:48 +01:00
|
|
|
|
protected NoAppCache() { }
|
2019-01-17 11:01:23 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the singleton instance.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static NoAppCache Instance { get; } = new NoAppCache();
|
|
|
|
|
|
|
2019-12-04 13:30:46 +11:00
|
|
|
|
/// <inheritdoc />
|
2019-12-04 09:11:57 +01:00
|
|
|
|
public bool IsAvailable => false;
|
2019-12-04 13:30:46 +11:00
|
|
|
|
|
2019-01-17 11:01:23 +01:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual object Get(string cacheKey)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual object Get(string cacheKey, Func<object> factory)
|
|
|
|
|
|
{
|
|
|
|
|
|
return factory();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-11-27 14:10:48 +01:00
|
|
|
|
public bool Set(string key, object value) => false;
|
|
|
|
|
|
|
|
|
|
|
|
public bool Remove(string key) => false;
|
|
|
|
|
|
|
2019-01-17 11:01:23 +01:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual IEnumerable<object> SearchByKey(string keyStartsWith)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Enumerable.Empty<object>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public IEnumerable<object> SearchByRegex(string regex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Enumerable.Empty<object>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2019-11-07 18:34:05 +11:00
|
|
|
|
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null)
|
2019-01-17 11:01:23 +01:00
|
|
|
|
{
|
|
|
|
|
|
return factory();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2019-11-07 18:34:05 +11:00
|
|
|
|
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null)
|
2019-01-17 11:01:23 +01:00
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void Clear()
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void Clear(string key)
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2020-03-19 08:53:18 +01:00
|
|
|
|
public virtual void ClearOfType(Type type)
|
2019-01-17 11:01:23 +01:00
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void ClearOfType<T>()
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void ClearOfType<T>(Func<string, T, bool> predicate)
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void ClearByKey(string keyStartsWith)
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public virtual void ClearByRegex(string regex)
|
|
|
|
|
|
{ }
|
2020-02-13 07:46:49 +01:00
|
|
|
|
|
|
|
|
|
|
public IEnumerator<KeyValuePair<string, object>> GetEnumerator() => new Dictionary<string, object>().GetEnumerator();
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
2019-01-17 11:01:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|