コード例 #1
0
        public void Put(string key, TCacheValue value, ExpiredMode mode, TimeSpan timespan)
        {
            ExpirationMode          expiretionMode = CacheUtility.ConvertFromCustomExpiredMode(mode);
            CacheItem <TCacheValue> item           = new CacheItem <TCacheValue>(key, value, expiretionMode, timespan);

            cacheManger.Put(item);
        }
コード例 #2
0
ファイル: CacheUtility.cs プロジェクト: yangdengfeng/Platform
        public static ExpirationMode ConvertFromCustomExpiredMode(ExpiredMode mode)
        {
            switch (mode)
            {
            case ExpiredMode.Default:
                return(ExpirationMode.Default);

            case ExpiredMode.None:
                return(ExpirationMode.None);

            case ExpiredMode.Sliding:
                return(ExpirationMode.Sliding);

            case ExpiredMode.Absolute:
                return(ExpirationMode.Absolute);

            default:
                return(ExpirationMode.None);
            }
        }