zoukankan      html  css  js  c++  java
  • 在使用Redis的客户端连接工具ServiceStack.Redis要注意的问题

    来源: 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
  • 相关阅读:
    pytest.4.Fixture
    pytest.3.Assert
    pytest.2.运行多个文件
    [LeetCode 378.] Kth Smallest Element in a Sorted Matrix
    priority_queue 自定义 comparator
    原地调整法查找数组元素
    [LeetCode 436.] Find Right Interval
    [LeetCode 611.] Valid Triangle Number
    二叉树Morris遍历
    用户态IO:DPDK
  • 原文地址:https://www.cnblogs.com/benhua/p/5910429.html
Copyright © 2011-2022 走看看