Initial import of the CBDDC codebase with docs and tests. Add a .NET-focused gitignore to keep generated artifacts out of source control.
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
45
src/ZB.MOM.WW.CBDDC.Core/Cache/IDocumentCache.cs
Executable file
45
src/ZB.MOM.WW.CBDDC.Core/Cache/IDocumentCache.cs
Executable file
@@ -0,0 +1,45 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZB.MOM.WW.CBDDC.Core.Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines operations for caching documents by collection and key.
|
||||
/// </summary>
|
||||
public interface IDocumentCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Clears all cached documents.
|
||||
/// </summary>
|
||||
void Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a cached document by collection and key.
|
||||
/// </summary>
|
||||
/// <param name="collection">The collection name.</param>
|
||||
/// <param name="key">The document key.</param>
|
||||
/// <returns>The cached document, or <see langword="null"/> if not found.</returns>
|
||||
Task<Document?> Get(string collection, string key);
|
||||
|
||||
/// <summary>
|
||||
/// Gets cache hit/miss statistics.
|
||||
/// </summary>
|
||||
/// <returns>A tuple containing hits, misses, current size, and hit rate.</returns>
|
||||
(long Hits, long Misses, int Size, double HitRate) GetStatistics();
|
||||
|
||||
/// <summary>
|
||||
/// Removes a cached document by collection and key.
|
||||
/// </summary>
|
||||
/// <param name="collection">The collection name.</param>
|
||||
/// <param name="key">The document key.</param>
|
||||
void Remove(string collection, string key);
|
||||
|
||||
/// <summary>
|
||||
/// Adds or updates a cached document.
|
||||
/// </summary>
|
||||
/// <param name="collection">The collection name.</param>
|
||||
/// <param name="key">The document key.</param>
|
||||
/// <param name="document">The document to cache.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
Task Set(string collection, string key, Document document);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user