在微信域名检测项目中,使用使用一个ReaderWriterLock来实现一个同步的Cache, 以便控制对该Cache的读写.但是效果很不好,后来采用利用ServiceStack.Redis来操作Redis,它是Redis官方推荐的C#客户端,性能非常优越,使用也很方便,但是运行中发现有如下的问题:
每小时只能访问Redis 6000次
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.Text, Version=4.5.6.0, Culture=neutral, PublicKeyToken=null
// Global type: <Module>
// Architecture: AnyCPU (64-bit preferred)
// Runtime: .NET 4.0
public static class LicenseUtils
{
//...
public static class FreeQuotas
{
public const int ServiceStackOperations = 10;
public const int TypeFields = 20;
public const int RedisTypes = 20;
public const int RedisRequestPerHour = 6000;
public const int OrmLiteTables = 10;
public const int AwsTables = 10;
public const int PremiumFeature = 0;
}
...
if (quotaType == QuotaType.RequestsPerHour)
{
LicenseUtils.ApprovedUsage(licenseFeature, feature, 6000, count, "The free-quota limit on '{0} Redis requests per hour' has been reached.
Please see https://servicestack.net to upgrade to a commercial license or
visit https://github.com/ServiceStackV3/ServiceStackV3 to revert back to the free ServiceStack v3.");
return;
}
....
}
我们把6000转换成字节形式是 70 17 00 00,直接用16进制编辑器打开ServiceStack.Text.dll 查找,修改为FF FF FF 7F,也就是int的最大值2147483647
本文介绍了在微信域名检测项目中遇到ServiceStack.Redis每小时6000次访问限制的问题。作者分享了解决此限制的方法,并提供了ServiceStack.Redis 4.5.6的下载链接。

4803

被折叠的 条评论
为什么被折叠?



