using System.Threading.Tasks;
namespace ZB.MOM.WW.CBDDC.Core.Cache
{
///
/// Defines operations for caching documents by collection and key.
///
public interface IDocumentCache
{
///
/// Clears all cached documents.
///
void Clear();
///
/// Gets a cached document by collection and key.
///
/// The collection name.
/// The document key.
/// The cached document, or if not found.
Task Get(string collection, string key);
///
/// Gets cache hit/miss statistics.
///
/// A tuple containing hits, misses, current size, and hit rate.
(long Hits, long Misses, int Size, double HitRate) GetStatistics();
///
/// Removes a cached document by collection and key.
///
/// The collection name.
/// The document key.
void Remove(string collection, string key);
///
/// Adds or updates a cached document.
///
/// The collection name.
/// The document key.
/// The document to cache.
/// A task that represents the asynchronous operation.
Task Set(string collection, string key, Document document);
}
}