namespace Core.Blueprint.Redis
{
    /// 
    /// Interface for managing Redis cache operations.
    /// 
    public interface IRedisCacheProvider
    {
        /// 
        /// Retrieves a cache item by its key.
        /// 
        /// The type of the cached item.
        /// The cache key.
        /// The cached item, or default if not found.
        ValueTask GetAsync(string key);
        /// 
        /// Sets a cache item with the specified key and value.
        /// 
        /// The type of the item to cache.
        /// The cache key.
        /// The item to cache.
        /// The optional expiration time for the cache item.
        /// A task representing the asynchronous operation.
        ValueTask SetAsync(string key, TEntity value, TimeSpan? expiry = null);
        /// 
        /// Removes a cache item by its key.
        /// 
        /// The cache key.
        /// A task representing the asynchronous operation.
        ValueTask RemoveAsync(string key);
        /// 
        /// Checks if a cache item exists for the specified key.
        /// 
        /// The cache key.
        /// True if the cache item exists; otherwise, false.
        ValueTask ExistsAsync(string key);
        /// 
        /// Refreshes the expiration time of a cache item if it exists.
        /// 
        /// The cache key.
        /// The new expiration time for the cache item.
        /// A task representing the asynchronous operation.
        ValueTask RefreshAsync(string key, TimeSpan? expiry = null);
    }
}