CodeSky 代码之空

Redis 分布式锁的实现 (opens in new tab)

>在 Redis 的常见应用中,分布式锁是一个老生常谈的问题,本文主要讲讲怎么去实现一个分布式锁(最近真·写了不少 Lua 脚本)。 ## 加锁 对于加锁操作,理论上应该是: 1. 尝试加锁,如果成功,则记录锁,并且返回 true 2. 如果失败,则不更新锁,返回 false <!--more--> 另外,1 或者 2 应该都是原子的。而 Redis 中针对

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help