using System.Threading;
using System.Threading.Tasks;

namespace StellaOps.Auth.Client;

/// <summary>
/// Abstraction for caching StellaOps tokens.
/// </summary>
public interface IStellaOpsTokenCache
{
    /// <summary>
    /// Retrieves a cached token entry, if present.
    /// </summary>
    ValueTask<StellaOpsTokenCacheEntry?> GetAsync(string key, CancellationToken cancellationToken = default);

    /// <summary>
    /// Stores or updates a token entry for the specified key.
    /// </summary>
    ValueTask SetAsync(string key, StellaOpsTokenCacheEntry entry, CancellationToken cancellationToken = default);

    /// <summary>
    /// Removes the cached entry for the specified key.
    /// </summary>
    ValueTask RemoveAsync(string key, CancellationToken cancellationToken = default);
}
