using System; using System.Collections.Generic; namespace Umbraco.Core.Cache { /// /// Defines an application cache. /// public interface IAppCache { /// /// Gets an item identified by its key. /// /// The key of the item. /// The item, or null if the item was not found. object Get(string key); /// /// Gets or creates an item identified by its key. /// /// The key of the item. /// A factory function that can create the item. /// The item. object Get(string key, Func factory); /// /// Gets items with a key starting with the specified value. /// /// The StartsWith value to use in the search. /// Items matching the search. IEnumerable SearchByKey(string keyStartsWith); /// /// Gets items with a key matching a regular expression. /// /// The regular expression. /// Items matching the search. IEnumerable SearchByRegex(string regex); /// /// Removes all items from the cache. /// void Clear(); /// /// Removes an item identified by its key from the cache. /// /// The key of the item. void Clear(string key); /// /// Removes items of a specified type from the cache. /// /// The type to remove. /// /// If the type is an interface, then all items of a type implementing that interface are /// removed. Otherwise, only items of that exact type are removed (items of type inheriting from /// the specified type are not removed). /// Performs a case-sensitive search. /// void ClearOfType(Type type); /// /// Removes items of a specified type from the cache. /// /// The type of the items to remove. /// If the type is an interface, then all items of a type implementing that interface are /// removed. Otherwise, only items of that exact type are removed (items of type inheriting from /// the specified type are not removed). void ClearOfType(); /// /// Removes items of a specified type from the cache. /// /// The type of the items to remove. /// The predicate to satisfy. /// If the type is an interface, then all items of a type implementing that interface are /// removed. Otherwise, only items of that exact type are removed (items of type inheriting from /// the specified type are not removed). void ClearOfType(Func predicate); /// /// Clears items with a key starting with the specified value. /// /// The StartsWith value to use in the search. void ClearByKey(string keyStartsWith); /// /// Clears items with a key matching a regular expression. /// /// The regular expression. void ClearByRegex(string regex); } }