We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
private String buildLuaScript() { StringBuilder lua = new StringBuilder(); lua.append( " local key = KEYS[1]" ); lua.append( "\nlocal limit = tonumber(ARGV[1])" ); lua.append( "\nlocal curentLimit = tonumber(redis.call('get', key) or \"0\")" ); lua.append( "\nif curentLimit + 1 > limit then" ); lua.append( "\nreturn 0" ); lua.append( "\nelse" ); lua.append( "\n redis.call(\"INCRBY\", key, 1)" ); lua.append( "\nredis.call(\"EXPIRE\", key, ARGV[2])" ); lua.append( "\nreturn curentLimit + 1" ); lua.append( "\nend" ); return lua.toString(); }
设置了redis的过期时间,这本质上还是计数器算法吧?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
设置了redis的过期时间,这本质上还是计数器算法吧?
The text was updated successfully, but these errors were encountered: