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

namespace BizAppFramework.Caching
{
    /// <summary>
    ///     Cache service interface.
    /// </summary>
    public interface ICacheService
    {
        TItem Get<TItem>(string key);

        Task<TItem> GetAsync<TItem>(string key, CancellationToken token = default(CancellationToken));
        
        void Set<TItem>(string key, TItem value, CacheEntryOptions options);

        Task SetAsync<TItem>(string key, TItem value, CacheEntryOptions options, CancellationToken token = default(CancellationToken));
        
        void Refresh(string key);

        Task RefreshAsync(string key, CancellationToken token = default(CancellationToken));
        
        void Remove(string key);

        Task RemoveAsync(string key, CancellationToken token = default(CancellationToken));
    }
}