﻿#region Copyright and License
/* @Copyright JONVON(NetCreditHub.COM) 2017. All rights reserved. - 8502090@qq.com */
#endregion

namespace NetCreditHub.Authorizations.Roles
{
    using System;
    using Zero;

    [Serializable]
    public class RoleObjectCacheItem
    {
        public static string CacheStoreName = $"{HubZeroConsts.ModuleName}.Role.";

        /// <summary>
        /// Role.FindById.{0}-{1}
        /// {0}: RoleType
        /// {1}: Id
        /// </summary>
        public static string FindByIdCacheKey = string.Concat(CacheStoreName, "FindById.{0}-{1}");

        /// <summary>
        /// Role.FindIdByCode.{0}-{1}
        /// {0}: RoleType
        /// {1}: Code
        /// </summary>
        public static string FindIdByCodeCacheKey = string.Concat(CacheStoreName, "FindIdByCode.{0}-{1}");

        /// <summary>
        /// 获取/设置缓存过期时间.
        /// 默认: 20 分钟.
        /// </summary>
        public static TimeSpan CacheExpireTime { get; private set; }

        public object CacheValue { get; set; }

        static RoleObjectCacheItem()
        {
            CacheExpireTime = TimeSpan.FromMinutes(20);
        }

        public RoleObjectCacheItem()
        {
            CacheValue = null;
        }
    }
}