//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System.IdentityModel.Configuration;
using System.Xml;
namespace System.IdentityModel.Tokens
{
///
/// This class defines the API for a cache that stores tokens for and purges them
/// on a schedule time interval.
///
public abstract class TokenReplayCache : ICustomIdentityConfiguration
{
///
/// Load custom configuration from Xml
///
/// Custom configuration elements
public virtual void LoadCustomConfiguration(XmlNodeList nodelist)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException(SR.GetString(SR.ID0023, this.GetType().AssemblyQualifiedName)));
}
///
/// Attempt to add a new entry or update an existing entry.
///
/// Key to use when adding item
/// SecurityToken to add to cache, can be null
/// The expiration time of the entry.
public abstract void AddOrUpdate(string key, SecurityToken securityToken, DateTime expirationTime);
///
/// Attempt to find if a matching entry exists in the cache.
///
/// The key to search for.
/// true if a matching entry is ifound in the cache, false otherwise
public abstract bool Contains(string key);
///
/// Attempt to get a SecurityToken
///
/// The key to search for.
/// The found, if any, null otherwise.
public abstract SecurityToken Get(string key);
///
/// Attempt to remove an entry from the cache
///
/// The key to the entry to remove
public abstract void Remove(string key);
}
}