diff options
author | vman <public@vaughnnugent.com> | 2022-11-18 17:15:36 -0500 |
---|---|---|
committer | vman <public@vaughnnugent.com> | 2022-11-18 17:15:36 -0500 |
commit | dc7ad57c845cc9b1b502e5e8b12ce96af4183dc4 (patch) | |
tree | 0ac786ac1fe0f1c7cc96c81c92363e6f760d036a /VNLib.Data.Caching.Global/IGlobalCacheProvider.cs | |
parent | 647ee25d7f71d3984a951a83a73b7c1aa506a402 (diff) |
Add project files.
Diffstat (limited to 'VNLib.Data.Caching.Global/IGlobalCacheProvider.cs')
-rw-r--r-- | VNLib.Data.Caching.Global/IGlobalCacheProvider.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/VNLib.Data.Caching.Global/IGlobalCacheProvider.cs b/VNLib.Data.Caching.Global/IGlobalCacheProvider.cs new file mode 100644 index 0000000..12b4b0b --- /dev/null +++ b/VNLib.Data.Caching.Global/IGlobalCacheProvider.cs @@ -0,0 +1,39 @@ + +namespace VNLib.Data.Caching.Global +{ + /// <summary> + /// An interface that a cache provoider must impelement to provide data caching to the + /// <see cref="GlobalDataCache"/> environment + /// </summary> + public interface IGlobalCacheProvider + { + /// <summary> + /// Gets a value that indicates if the cache provider is currently available + /// </summary> + public bool IsConnected { get; } + + /// <summary> + /// Asynchronously gets a value from the backing cache store + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key">The key identifying the object to recover from cache</param> + /// <returns>The value if found, or null if it does not exist in the store</returns> + Task<T?> GetAsync<T>(string key); + + /// <summary> + /// Asynchronously sets (or updates) a cached value in the backing cache store + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key">The key identifying the object to recover from cache</param> + /// <param name="value">The value to set at the given key</param> + /// <returns>A task that completes when the update operation has compelted</returns> + Task SetAsync<T>(string key, T value); + + /// <summary> + /// Asynchronously deletes an item from cache by its key + /// </summary> + /// <param name="key">The key identifying the item to delete</param> + /// <returns>A task that completes when the delete operation has compelted</returns> + Task DeleteAsync(string key); + } +}
\ No newline at end of file |