V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
itx10237
V2EX  ›  Redis

Redis 怎样将字节串传递给 lua 脚本?

  •  
  •   itx10237 · Mar 30, 2024 · 4369 views
    This topic created in 757 days ago, the information mentioned may be changed or developed.

    struct PersonInfo { int age; char addr[10]; };

    PersonInfo person_info; person_info.age = 20; strcpy(person_info.addr, "sz");

    redisContext * cc;

    std::string name = "JACK";

    如果要将上面的 name 和 person_info 传给 lua 脚本,应该怎么做呢? 下面的写法是不完整的, 但是又不知道该怎么写才对.

    redisCommand(cc, "EVALSHA %s 1 %s", "redis 返回的 lua 脚本 sha1 值", name.c_str());

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3819 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 10:38 · PVG 18:38 · LAX 03:38 · JFK 06:38
    ♥ Do have faith in what you're doing.