using System.Collections.Generic;

namespace HTCoreServiceApp.Common
{
    public interface IMemoryCacheHelper
    {
        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <typeparam name="TValue">缓存值类型</typeparam>
        /// <param name="key">键</param>
        /// <returns>缓存值</returns>
        TValue Get<TValue>(string key);

        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <typeparam name="TValue">缓存值类型</typeparam>
        /// <param name="keys">键集合</param>
        /// <returns>缓存值集合</returns>
        List<TValue> Get<TValue>(List<string> keys);

        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <typeparam name="TValue">缓存值类型</typeparam>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <param name="expires">过期时间</param>
        /// <param name="isSliding">是否滑动过期</param>
        /// <returns>是否成功</returns>
        bool Set<TValue>(string key, TValue value, int expires = 0, bool isSliding = false);

        /// <summary>
        /// 判断缓存是否存在
        /// </summary>
        /// <param name="key">键</param>
        /// <returns>是否存在</returns>
        bool IsExist(string key);

        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="key">键</param>
        /// <returns>是否成功</returns>
        bool Remove(string key);

        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="keys">键集合</param>
        /// <returns>是否成功</returns>
        bool Remove(List<string> keys);
    }
}
