GithubHelp home page GithubHelp logo

Comments (4)

raffertyyu avatar raffertyyu commented on May 27, 2024

请问方便发下具体的命令 以及是否可以复现吗。

from tendis.

smile689 avatar smile689 commented on May 27, 2024

@raffertyyu 其实就是参照了redission的方法。项目代码里面具体的lua脚本就是如下几段:
--- 获取锁
"if (redis.call('exists', KEYS[1]) == 0) " +
"then redis.call('hset', KEYS[1],ARGV[1], 1); " +
"redis.call('pexpire', KEYS[1], ARGV[2]); " +
"return nil; end; " +
"if (redis.call('hexists', KEYS[1], ARGV[1]) == 1) " +
"then redis.call('hincrby', KEYS[1], ARGV[1], 1); " +
"redis.call('pexpire', KEYS[1], ARGV[2]); " +
"return nil; end; " +
"return redis.call('pttl', KEYS[1]);"

--- 释放锁
"if (redis.call('exists', KEYS[1]) == 0) then return 0; end; " +
"if (redis.call('hexists', KEYS[1], ARGV[1]) == 0) then return 0; end; " +
"local counter = redis.call('hincrby', KEYS[1], ARGV[1], -1); " +
"if (counter > 0) then redis.call('pexpire', KEYS[1], ARGV[2]); return 1; " +
"else redis.call('del', KEYS[1]); return 1; end;"

实际查看日志,目前正常一直会有这样的日志。

from tendis.

raffertyyu avatar raffertyyu commented on May 27, 2024

我看了一下代码,这里是tendis 在执行evalsha的时候没找到对应的脚本打的日志,一般是由于没有提前执行script load 导致的。属于正常现象,确实不应该打日志。后续版本我去掉这个日志提示。

from tendis.

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.