來源: http://www.cnblogs.com/duanweishi/p/5818991.html
Redis是一個非常NB的內存級的數據庫,我們可以把很多”熱數據“(即讀寫非常多的數據)放入其中來操作,這樣就減少了和關系型數據庫(如SqlServer/My Sql等)之間的交互,程序的響應速度也大大提升。
C#利用ServiceStack.Redis來操作Redis,它是Redis官方推薦的C#客戶端,性能非常優越,使用也很方便,但是我最近在使用這個工具的時候碰到兩個問題:
1、每小時只能訪問Redis 6000次
2、用 GetById 方法獲取不到對象。
第一個問題一開始本地測試的時候並沒有發現,因為我們的數據量小,每小時訪問Redis次數也少,但是到了服務器上發現老是報這個錯誤:
The free-quota limit on ‘6000 Redis requests per hour‘ has been reached. Please see https://servicestack.net to upgrade to a commercial license.
在ServiceStack的官網(https://servicestack.net/download)上看到了關於這個錯誤的說明:原來 ServiceStack v4版本已經逐漸商業化了,普通版每小時只能訪問Redis 6000次,要取消這個限制就要付費或者您也可以往回使用V3版本。
在 https://servicestack.net/download 頁面的最下方。
Free Quotas
Whilst ServiceStack v4 is a commercially-supported product, we also allow free usage for small projects and evaluation purposes.
The nuget packages above include the quota's below which can be unlocked with a license key:
10 Operations in ServiceStack (i.e. Request DTOs)
10 Tables in OrmLite
20 Different Types in JSON, JSV and CSV Serializers *
20 Different Types in Redis Client Typed APIs
6000 requests per hour with the Redis Client
* These quotas are lifted in ServiceStack.Client generic service clients allowing un-restricted access when consuming ServiceStack services.
解決辦法:
可以使用另外一個性能不錯的StackExchange.Redis或者使用低於4的ServiceStack.Redis版本。
StackExchange.Redis下載地址:
https://github.com/StackExchange/StackExchange.Redis
低版本的ServiceStack.Redis下載地址:
https://github.com/ServiceStackV3/ServiceStackV3
在VS中使用NuGet程序包管理器控制台主機版本,安裝ServiceStack.Redis版本:
PM> Install-Package ServiceStack -Version 3.9.71