ServiceStack.Redis 緩衝到期,並未失效的暫時解決辦法

來源:互聯網
上載者:User

標籤:

伺服器:Redis版本運行環境,生產環境是全記憶體運行。

用戶端NuGet 引入:ServiceStack.Redis

加入緩衝代碼:

        /// <summary>        ///  Set        /// </summary>        /// <typeparam name="T">類型</typeparam>        /// <param name="key">鍵</param>        /// <param name="t">值</param>        /// <param name="timeout">多少分鐘後到期</param>        /// <returns></returns>        public static bool Set<T>(string key, T t, double minOut = 60*3)        {            using (var redisClient = RedisManager.GetClient())            {                key = "Str_" + key;                return redisClient.Set<T>(key, t, ExpireDateTime(minOut));            }        }

但過了相應的時間之後,緩衝沒有失效。做了各種嘗試.... 最後:

 擷取所有緩衝名稱

List<string> GetAllKeys();

 定點清除,也可以全部幹掉

        void FlushAll();        T Get<T>(string key);        IDictionary<string, T> GetAll<T>(IEnumerable<string> keys);        long Increment(string key, uint amount);        bool Remove(string key);        void RemoveAll(IEnumerable<string> keys);

希望給一些方法。解決問題不全都靠技術,方法也行。 

ServiceStack.Redis 緩衝到期,並未失效的暫時解決辦法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.