Giter Club home page Giter Club logo

Comments (9)

2881099 avatar 2881099 commented on June 30, 2024

我没有你的环境,无法判断修改哪里有效。

后续建议用持续更新新功能的 FreeRedis,是全新重写的,支持更多功能。

from csredis.

edobnet avatar edobnet commented on June 30, 2024

FreeRedis,本地是没有问题,到客户有现场也有问题本地TongRds比客户现场高一版本,只能升级试一下了,
image

from csredis.

edobnet avatar edobnet commented on June 30, 2024

csredis出错在ROLE命令
image
image

image

from csredis.

edobnet avatar edobnet commented on June 30, 2024

哨兵端口是这样
image
6379端口是这样
image

from csredis.

2881099 avatar 2881099 commented on June 30, 2024

FreeRedis 的报错是连接超时,你在哨兵执行一下命令:

SENTINEL GET-MASTER-ADDR-BY-NAME sbcluster

看看返回什么,是不是可以连接的 IP,我猜返回的是内网IP,导致你的程序无法连接,连接超时。

csredis 的协议处理没有 FreeRedis 先进,对返回内容要求比较严格,我看你的截图返回的格式,应该是 TONG RDS 魔改过。

建议使用 FreeRedis

from csredis.

edobnet avatar edobnet commented on June 30, 2024

已经用FreeRedis, 不过多线程get性能测试慢50%左右

from csredis.

2881099 avatar 2881099 commented on June 30, 2024

把测试代码和测试过程发一下

from csredis.

edobnet avatar edobnet commented on June 30, 2024

就并行一直读指定数量键值。

using XCRMS.Xcrs.PCL.Core;
using Xunit.Abstractions;

namespace XCRMS.DAL.Test.Cache {
    [TestCaseOrderer("XCRMS.DAL.Test.TestCaseOrderer", "XCRMS.DAL.Test")]
    public class TestRedis: BaseTest {
        public TestRedis(ITestOutputHelper output) : base(output) {
        }

        [Theory(DisplayName = "01.init")]
        [InlineData("aaa","11111")]
        public void Test0(string key,string v ) {
         
            RedisUtil.Set(key, v,36000);
           // var aa =  RedisUtil.Get2(key);
           // Assert.Equal(v, aa);
        }
        [Theory(DisplayName = "02_02.getPerformace")]
        [InlineData("aaa", 100)]
        public void Test1_1(string key, int count) {
          RedisUtil.Get<string>(key);
            Parallel.For(0, count, i => {
                var aa = RedisUtil.Get<string>(key);
                if (aa != "11111") {
                    Output.WriteLine(aa);
                }
            }
            );
        }

    }
}

RedisUtil 以前
public class RedisUtil : RedisHelper {
public static void Init(string conn) {

        //哨兵模式
        if (conn.StartsWith("[")) {
           int eIndex = conn.IndexOf("]");
           var servers = conn[1..eIndex].Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries);
            Initialization(new CSRedisClient(conn[(eIndex + 1)..], servers));
        }
        else {
             Initialization(new CSRedisClient(conn));
        }
    }
}

}

用FreeRedis
public class RedisUtil {

public static RedisClient cli;
public static void Init(string conn) {
    //哨兵模式
    if (conn.StartsWith("[")) {
        int eIndex = conn.IndexOf("]");
        var servers = conn[1..eIndex].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        string connStr = conn[(eIndex + 1)..];
         cli = new RedisClient(connStr,servers, false);
    }
    else {
        cli = new RedisClient(conn);
    }
    cli.Serialize = obj => JsonConvert.SerializeObject(obj);
    cli.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type);
}


public static A Get<A>(string v) {
    return cli.Get<A>(v);
}

之前也测试了,StackExchange.Redis
还是csredis最高。

from csredis.

2881099 avatar 2881099 commented on June 30, 2024

请提供一个可以直接运行测试的 console app

from csredis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.