using System; using System.Collections.Generic; namespace OwinFramework.InterfacesV1.Facilities { /// /// An object of this type is returned by the cache facility /// [Obsolete("There is a V2 of the ICache interface that provides more features")] public interface ICache { /// /// Tries to get a value from the cache if it is present /// /// The type of data stored the cache against this key /// A key that identifies a piece of data in the cache /// The value to return if the cache does not contain this key /// Optional time to lock the value in the cache. Updating the cache will clear the lock /// Optional category. Cache implementations can choose different caching strategies for different categories of data /// The cached value or the default value if not in cache T Get(string key, T defaultValue = default(T), TimeSpan? lockTime = null, string category = null); /// /// Overwrites data in the cache and unlocks it if locked /// /// The type of data to store in the cache. Must be serializable for distributed caches /// A key that identifies a piece of data in the cache /// The data to store in the cache /// How long to keep the data in cache. If you pass null the cache will decide /// Optional category. Cache implementations can choose different caching strategies for different categories of data /// True if the data was overwritten and False if data was inserted bool Put(string key, T value, TimeSpan? lifespan = null, string category = null); /// /// Deletes an entry in the cache /// /// A key that identifies a piece of data in the cache /// Optional category. Cache implementations can choose different caching strategies for different categories of data /// True if the data was deleted and False if data was not in the cache bool Delete(string key, string category = null); } }