{"id":73770,"date":"2026-02-08T11:10:20","date_gmt":"2026-02-08T03:10:20","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/73770.html"},"modified":"2026-02-08T11:10:20","modified_gmt":"2026-02-08T03:10:20","slug":"%e5%9f%ba%e4%ba%8e-redis-%e7%9a%84%e7%a7%92%e6%9d%80%e9%9b%86%e7%be%a4%e7%b3%bb%e7%bb%9f%e8%bf%ad%e4%bb%a3%e5%ae%9e%e7%8e%b0%e3%80%90redisson%e6%ba%90%e7%a0%81%e5%88%86%e6%9e%90%e3%80%91%ef%bc%88","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/73770.html","title":{"rendered":"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09"},"content":{"rendered":"<h2 style=\"background-color:transparent\">\u4e00\u3001\u524d\u7f6e\u5185\u5bb9<\/h2>\n<h3 style=\"background-color:transparent\">1.1 \u5355\u673a\u79d2\u6740\u5b9e\u73b0<\/h3>\n<p>\u57fa\u4e8e Redis \u7684\u79d2\u6740\u5355\u673a\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2<\/p>\n<h3 style=\"background-color:transparent\">1.2 SETNX\u5b9e\u73b0\u96c6\u7fa4\u6a21\u5f0f\u4e0b<\/h3>\n<p>\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010SETNX\u3011&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2<\/p>\n<h3>1.3 \u524d\u7f6e\u6d41\u7a0b\u56fe\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1465\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031006-6987fe8e1771d.png\" width=\"1569\" \/><\/h3>\n<h3 style=\"background-color:transparent\">1.4 \u524d\u7f6e\u95ee\u9898<\/h3>\n<p>\u7528SETNX\u5b9e\u73b0\u7684\u9501&#xff0c;\u6709\u4e0d\u53ef\u91cd\u5165&#xff0c;\u4e0d\u53ef\u91cd\u8bd5&#xff0c;\u9501\u8fc7\u671f&#xff0c;\u4e3b\u4ece\u4e0d\u4e00\u81f4\u7684\u95ee\u9898<\/p>\n<h2>\u4e8c\u3001Redisson\u9501<\/h2>\n<h3>2.1 \u4ecb\u7ecd<\/h3>\n<p>Redisson \u662f\u4e00\u4e2a\u57fa\u4e8e Redis \u7684 Java \u5ba2\u6237\u7aef&#xff0c;\u5b83\u4e0d\u4ec5\u5c01\u88c5\u4e86 Redis \u7684\u57fa\u7840\u64cd\u4f5c&#xff0c;\u8fd8\u63d0\u4f9b\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5206\u5e03\u5f0f\u9501\u5b9e\u73b0&#xff0c;\u89e3\u51b3\u4e86\u539f\u751f Redis \u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\u65f6\u7684\u8bf8\u591a\u75db\u70b9&#xff08;\u6bd4\u5982\u9501\u81ea\u52a8\u7eed\u671f\u3001\u6b7b\u9501\u3001\u91ca\u653e\u522b\u4eba\u7684\u9501\u7b49\u95ee\u9898&#xff09;\u3002<\/p>\n<h3>2.2 \u7279\u70b9<\/h3>\n<p>\u53ef\u91cd\u5165\u9501&#xff1a;\u652f\u6301\u7ebf\u7a0b\u91cd\u5165&#xff08;\u540c\u4e00\u4e2a\u7ebf\u7a0b\u591a\u6b21\u83b7\u53d6\u540c\u4e00\u628a\u9501\u4e0d\u4f1a\u6b7b\u9501&#xff09;&#xff0c;\u7b26\u5408 Java \u4e2d\u00a0ReentrantLock\u00a0\u7684\u7279\u6027\u3002<\/p>\n<ul>\n<li>\u81ea\u52a8\u7eed\u671f&#xff08;\u770b\u95e8\u72d7\u673a\u5236&#xff09;&#xff1a;\u8fd9\u662f Redisson \u9501\u6700\u6838\u5fc3\u7684\u7279\u6027\u3002\u5f53\u6301\u6709\u9501\u7684\u7ebf\u7a0b\u56e0\u4e3a\u4e1a\u52a1\u903b\u8f91\u6267\u884c\u65f6\u95f4\u8fc7\u957f&#xff0c;\u8d85\u8fc7\u4e86\u9501\u7684\u8fc7\u671f\u65f6\u95f4\u65f6&#xff0c;Redisson \u4f1a\u81ea\u52a8\u4e3a\u9501\u7eed\u671f&#xff08;\u9ed8\u8ba4\u6bcf 30 \u79d2\u7eed\u671f\u4e00\u6b21&#xff0c;\u9501\u9ed8\u8ba4\u8fc7\u671f\u65f6\u95f4 30 \u79d2&#xff09;&#xff0c;\u907f\u514d\u9501\u63d0\u524d\u91ca\u653e\u5bfc\u81f4\u5e76\u53d1\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h3 style=\"background-color:transparent\">\u00a02.3 \u4f7f\u7528<\/h3>\n<p>&#064;Configuration<br \/>\npublic class RedissonConfig {<\/p>\n<p>    &#064;Bean<br \/>\n    public RedissonClient redissonClient(){<br \/>\n        \/\/ \u914d\u7f6e<br \/>\n        Config config &#061; new Config();<br \/>\n        config.useSingleServer().setAddress(&#034;\u5730\u5740&#034;)<br \/>\n            .setPassword(&#034;\u5bc6\u7801&#034;);<br \/>\n        \/\/ \u521b\u5efaRedissonClient\u5bf9\u8c61<br \/>\n        return Redisson.create(config);<br \/>\n    }<br \/>\n}<br \/>\n    &#064;Override<br \/>\n    &#064;Transactional<br \/>\n    public Long seckillVoucher(Long voucherId) {<br \/>\n        \/\/ 1.\u67e5\u8be2\u4f18\u60e0\u5238<br \/>\n        SeckillVoucher voucher &#061; seckillVoucherService.getById(voucherId);<br \/>\n        \/\/ 2.\u5224\u65ad\u79d2\u6740\u662f\u5426\u5f00\u59cb<br \/>\n        if (voucher.getBeginTime().isAfter(LocalDateTime.now())) {<br \/>\n            \/\/ \u5c1a\u672a\u5f00\u59cb<br \/>\n            throw new BaseException(ExceptionConstants.NOT_START);<br \/>\n        }<br \/>\n        \/\/ 3.\u5224\u65ad\u79d2\u6740\u662f\u5426\u5df2\u7ecf\u7ed3\u675f<br \/>\n        if (voucher.getEndTime().isBefore(LocalDateTime.now())) {<br \/>\n            \/\/ \u5c1a\u672a\u5f00\u59cb<br \/>\n            throw new BaseException(ExceptionConstants.IS_END);<br \/>\n        }<br \/>\n        \/\/ 4.\u5224\u65ad\u5e93\u5b58\u662f\u5426\u5145\u8db3<br \/>\n        if (voucher.getStock() &lt; 1) {<br \/>\n            \/\/ \u5e93\u5b58\u4e0d\u8db3<br \/>\n            throw new BaseException(ExceptionConstants.NOT_ENOUGH);<br \/>\n        }<br \/>\n        Long userId &#061; UserHolder.getUser().getId();<br \/>\n        String key &#061; RedisConstants.getLockOrderKey(userId);<br \/>\n        RLock lock &#061; redissonClient.getLock(key);<br \/>\n        boolean isLock &#061; lock.tryLock();<br \/>\n        if (!isLock) {<br \/>\n            \/\/ \u83b7\u53d6\u9501\u5931\u8d25&#xff0c;\u8fd4\u56de\u9519\u8bef\u6216\u91cd\u8bd5<br \/>\n            throw new BaseException(ExceptionConstants.EXIST_BUY);<br \/>\n        }<br \/>\n        try {<br \/>\n            IVoucherOrderService proxy &#061; (IVoucherOrderService) AopContext.currentProxy();<br \/>\n            return proxy.createVoucherOrder(voucherId);<br \/>\n        } catch (IllegalStateException e) {<br \/>\n            throw new RuntimeException(e);<br \/>\n        } finally {<br \/>\n            lock.unlock();<br \/>\n        }<br \/>\n    } <\/p>\n<p>\u8fd9\u91cc\u7684\u9501\u4ece\u539f\u6765\u81ea\u5df1\u5b9e\u73b0\u53d8\u6210\u4e86\u4f7f\u7528\u73b0\u6210\u7684Api<\/p>\n<h2 style=\"background-color:transparent\">\u4e09\u3001\u4f7f\u7528Redisson\u9501\u89e3\u51b3\u4e0d\u53ef\u91cd\u5165<\/h2>\n<ul>\n<li>\u53ef\u91cd\u5165\u9501&#xff1a;\u652f\u6301\u7ebf\u7a0b\u91cd\u5165&#xff08;\u540c\u4e00\u4e2a\u7ebf\u7a0b\u591a\u6b21\u83b7\u53d6\u540c\u4e00\u628a\u9501\u4e0d\u4f1a\u6b7b\u9501&#xff09;&#xff0c;\u7b26\u5408 Java \u4e2d\u00a0ReentrantLock\u00a0\u7684\u7279\u6027\u3002<\/li>\n<\/ul>\n<h3>3.1\u00a0\u53ef\u91cd\u5165\u9501\u548c\u4e0d\u53ef\u91cd\u5165\u9501<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1340\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031007-6987fe8f3ee6a.png\" width=\"2188\" \/><\/p>\n<h3 style=\"background-color:transparent\">3.2\u00a0Redisson\u53ef\u91cd\u5165\u9501\u5b9e\u73b0\u539f\u7406<\/h3>\n<p>\u539f\u6765\u7684\u9501\u952e\u662f\u7528\u6237&#xff0c;\u9501\u662f\u7ebf\u7a0b<\/p>\n<p>Redisson\u9501\u5728redis\u4e2d\u5b58\u50a8\u7684\u662fhash\u7ed3\u6784&#xff0c;\u5927\u952e\u662f\u7528\u6237&#xff0c;\u5c0f\u952e\u662f\u7ebf\u7a0b&#xff0c;\u503c\u662f\u9501\u7684\u91cd\u590d\u6b21\u6570<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1445\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031008-6987fe90b282b.png\" width=\"1442\" \/><\/p>\n<h3 style=\"background-color:transparent\">3.3\u00a0\u6d41\u7a0b\u56fe<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1473\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031009-6987fe9154a05.png\" width=\"1933\" \/><\/p>\n<h2>\u56db\u3001\u53ef\u91cd\u5165\u6e90\u7801<\/h2>\n<h3 style=\"background-color:transparent\">4.1 \u52a0\u9501<\/h3>\n<p>\u8fdb\u5165RedissonLock.tryLock()&#xff0c;\u6b64\u7c7b\u5b9e\u73b0\u4e86Rlock\u63a5\u53e3<br \/>\n    public boolean tryLock() {<br \/>\n        return (Boolean)this.get(this.tryLockAsync());<br \/>\n    }<\/p>\n<p>    public RFuture&lt;Boolean&gt; tryLockAsync() {<br \/>\n        return this.tryLockAsync(Thread.currentThread().getId());<br \/>\n    }<\/p>\n<p>    public RFuture&lt;Boolean&gt; tryLockAsync(long threadId) {<br \/>\n        return this.tryAcquireOnceAsync(-1L, -1L, (TimeUnit)null, threadId);<br \/>\n    }<\/p>\n<p>    private RFuture&lt;Boolean&gt; tryAcquireOnceAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId) {<br \/>\n        if (leaseTime !&#061; -1L) {<br \/>\n            return this.&lt;Boolean&gt;tryLockInnerAsync(waitTime, leaseTime, unit, threadId, RedisCommands.EVAL_NULL_BOOLEAN);<br \/>\n        } else {<br \/>\n            RFuture&lt;Boolean&gt; ttlRemainingFuture &#061; this.&lt;Boolean&gt;tryLockInnerAsync(waitTime, this.commandExecutor.getConnectionManager().getCfg().getLockWatchdogTimeout(), TimeUnit.MILLISECONDS, threadId, RedisCommands.EVAL_NULL_BOOLEAN);<br \/>\n            ttlRemainingFuture.onComplete((ttlRemaining, e) -&gt; {<br \/>\n                if (e &#061;&#061; null) {<br \/>\n                    if (ttlRemaining) {<br \/>\n                        this.scheduleExpirationRenewal(threadId);<br \/>\n                    }<\/p>\n<p>                }<br \/>\n            });<br \/>\n            return ttlRemainingFuture;<br \/>\n        }<br \/>\n    } <\/p>\n<ul>\n<li>\u00a0\u540c\u6b65\u5c01\u88c5\u5f02\u6b65&#xff1a;tryLock()\u00a0\u662f\u540c\u6b65\u5165\u53e3&#xff0c;\u672c\u8d28\u662f\u963b\u585e\u8c03\u7528\u5f02\u6b65\u7684\u00a0tryLockAsync()\u00a0\u83b7\u53d6\u7ed3\u679c\u3002<\/li>\n<li>\u53c2\u6570\u9ed8\u8ba4\u503c&#xff1a;\u9ed8\u8ba4\u8c03\u7528\u65f6\u00a0waitTime&#061;-1&#xff08;\u4e0d\u7b49\u5f85&#xff0c;\u76f4\u63a5\u62a2\u9501&#xff09;\u3001leaseTime&#061;-1&#xff08;\u4e0d\u8bbe\u9501\u7b49\u5f85\u65f6\u95f4&#xff09;\u3002<\/li>\n<li>\u00a0\u8c03\u7528tryLockInnerAsync\u00a0\u00a0<\/li>\n<\/ul>\n<p>    &lt;T&gt; RFuture&lt;T&gt; tryLockInnerAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId, RedisStrictCommand&lt;T&gt; command) {<br \/>\n        this.internalLockLeaseTime &#061; unit.toMillis(leaseTime);<br \/>\n        return this.&lt;T&gt;evalWriteAsync(this.getName(), LongCodec.INSTANCE, command,<br \/>\n&#034;if (redis.call(&#039;exists&#039;, KEYS[1]) &#061;&#061; 0) then&#034;&#043;<br \/>\n&#034; redis.call(&#039;hincrby&#039;, KEYS[1], ARGV[2], 1); &#034;&#043;<br \/>\n&#034;redis.call(&#039;pexpire&#039;, KEYS[1], ARGV[1]);&#034;&#043;<br \/>\n&#034;return nil;&#034;&#043;<br \/>\n&#034;end;&#034;&#043;<br \/>\n&#034;if (redis.call(&#039;hexists&#039;, KEYS[1], ARGV[2]) &#061;&#061; 1) then &#034;&#043;<br \/>\n&#034;redis.call(&#039;hincrby&#039;, KEYS[1], ARGV[2], 1); &#034;&#043;<br \/>\n&#034;redis.call(&#039;pexpire&#039;, KEYS[1], ARGV[1]); &#034;&#043;<br \/>\n&#034;return nil; &#034;&#043;<br \/>\n&#034;end; &#034;&#043;<br \/>\n&#034;return redis.call(&#039;pttl&#039;, KEYS[1]);&#034;,<br \/>\nCollections.singletonList(this.getName()), this.internalLockLeaseTime, this.getLockName(threadId));<br \/>\n    } <\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1375\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031010-6987fe92618a0.png\" width=\"1161\" \/>\u00a0<\/p>\n<h3 style=\"background-color:transparent\">4.2 \u91ca\u653e\u9501<\/h3>\n<p>    public void unlock() {<br \/>\n        try {<br \/>\n            this.get(this.unlockAsync(Thread.currentThread().getId()));<br \/>\n        } catch (RedisException e) {<br \/>\n            if (e.getCause() instanceof IllegalMonitorStateException) {<br \/>\n                throw (IllegalMonitorStateException)e.getCause();<br \/>\n            } else {<br \/>\n                throw e;<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    public RFuture&lt;Void&gt; unlockAsync(long threadId) {<br \/>\n        RPromise&lt;Void&gt; result &#061; new RedissonPromise();<br \/>\n        RFuture&lt;Boolean&gt; future &#061; this.unlockInnerAsync(threadId);<br \/>\n        future.onComplete((opStatus, e) -&gt; {<br \/>\n            this.cancelExpirationRenewal(threadId);<br \/>\n            if (e !&#061; null) {<br \/>\n                result.tryFailure(e);<br \/>\n            } else if (opStatus &#061;&#061; null) {<br \/>\n                IllegalMonitorStateException cause &#061; new IllegalMonitorStateException(&#034;attempt to unlock lock, not locked by current thread by node id: &#034; &#043; this.id &#043; &#034; thread-id: &#034; &#043; threadId);<br \/>\n                result.tryFailure(cause);<br \/>\n            } else {<br \/>\n                result.trySuccess((Object)null);<br \/>\n            }<br \/>\n        });<br \/>\n        return result;<br \/>\n    }<\/p>\n<p>    protected RFuture&lt;Boolean&gt; unlockInnerAsync(long threadId) {<br \/>\n        return this.&lt;Boolean&gt;evalWriteAsync(this.getName(), LongCodec.INSTANCE,<br \/>\nRedisCommands.EVAL_BOOLEAN, &#034;if (redis.call(&#039;hexists&#039;, KEYS[1], ARGV[3]) &#061;&#061; 0) then<br \/>\nreturn nil;end; local counter &#061; redis.call(&#039;hincrby&#039;, KEYS[1], ARGV[3], -1); if (counter<br \/>\n&gt; 0) then redis.call(&#039;pexpire&#039;, KEYS[1], ARGV[2]); return 0; else redis.call(&#039;del&#039;,<br \/>\nKEYS[1]); redis.call(&#039;publish&#039;, KEYS[2], ARGV[1]); return 1; end; return nil;&#034;,<br \/>\nArrays.asList(this.getName(), this.getChannelName()), LockPubSub.UNLOCK_MESSAGE,<br \/>\nthis.internalLockLeaseTime, this.getLockName(threadId));<br \/>\n    } <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"567\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031010-6987fe92dc099.png\" width=\"506\" \/><\/p>\n<h2 style=\"background-color:transparent\">\u4e94\u3001\u4f7f\u7528Redisson\u9501\u89e3\u51b3\u4e0d\u53ef\u91cd\u8bd5<\/h2>\n<h3 style=\"background-color:transparent\">5.1 \u52a0\u9501<\/h3>\n<p>    public boolean tryLock(long waitTime, TimeUnit unit) throws InterruptedException {<br \/>\n        return this.tryLock(waitTime, -1L, unit);<br \/>\n    }<\/p>\n<p>    public boolean tryLock(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException {<br \/>\n        long time &#061; unit.toMillis(waitTime);<br \/>\n        long current &#061; System.currentTimeMillis();<br \/>\n        long threadId &#061; Thread.currentThread().getId();<br \/>\n        Long ttl &#061; this.tryAcquire(waitTime, leaseTime, unit, threadId);<br \/>\n        if (ttl &#061;&#061; null) {<br \/>\n            return true;<br \/>\n        } else {<br \/>\n            time -&#061; System.currentTimeMillis() &#8211; current;<br \/>\n            if (time &lt;&#061; 0L) {<br \/>\n                this.acquireFailed(waitTime, unit, threadId);<br \/>\n                return false;<br \/>\n            } else {<br \/>\n                current &#061; System.currentTimeMillis();<br \/>\n                RFuture&lt;RedissonLockEntry&gt; subscribeFuture &#061; this.subscribe(threadId);<br \/>\n                if (!subscribeFuture.await(time, TimeUnit.MILLISECONDS)) {<br \/>\n                    if (!subscribeFuture.cancel(false)) {<br \/>\n                        subscribeFuture.onComplete((res, e) -&gt; {<br \/>\n                            if (e &#061;&#061; null) {<br \/>\n                                this.unsubscribe(subscribeFuture, threadId);<br \/>\n                            }<\/p>\n<p>                        });<br \/>\n                    }<\/p>\n<p>                    this.acquireFailed(waitTime, unit, threadId);<br \/>\n                    return false;<br \/>\n                } else {<br \/>\n                    boolean var14;<br \/>\n                    try {<br \/>\n                        time -&#061; System.currentTimeMillis() &#8211; current;<br \/>\n                        if (time &gt; 0L) {<br \/>\n                            do {<br \/>\n                                long currentTime &#061; System.currentTimeMillis();<br \/>\n                                ttl &#061; this.tryAcquire(waitTime, leaseTime, unit, threadId);<br \/>\n                                if (ttl &#061;&#061; null) {<br \/>\n                                    boolean var28 &#061; true;<br \/>\n                                    return var28;<br \/>\n                                }<\/p>\n<p>                                time -&#061; System.currentTimeMillis() &#8211; currentTime;<br \/>\n                                if (time &lt;&#061; 0L) {<br \/>\n                                    this.acquireFailed(waitTime, unit, threadId);<br \/>\n                                    boolean var27 &#061; false;<br \/>\n                                    return var27;<br \/>\n                                }<\/p>\n<p>                                currentTime &#061; System.currentTimeMillis();<br \/>\n                                if (ttl &gt;&#061; 0L &amp;&amp; ttl &lt; time) {<br \/>\n                                    ((RedissonLockEntry)subscribeFuture.getNow()).getLatch().tryAcquire(ttl, TimeUnit.MILLISECONDS);<br \/>\n                                } else {<br \/>\n                                    ((RedissonLockEntry)subscribeFuture.getNow()).getLatch().tryAcquire(time, TimeUnit.MILLISECONDS);<br \/>\n                                }<\/p>\n<p>                                time -&#061; System.currentTimeMillis() &#8211; currentTime;<br \/>\n                            } while(time &gt; 0L);<\/p>\n<p>                            this.acquireFailed(waitTime, unit, threadId);<br \/>\n                            boolean var16 &#061; false;<br \/>\n                            return var16;<br \/>\n                        }<\/p>\n<p>                        this.acquireFailed(waitTime, unit, threadId);<br \/>\n                        var14 &#061; false;<br \/>\n                    } finally {<br \/>\n                        this.unsubscribe(subscribeFuture, threadId);<br \/>\n                    }<\/p>\n<p>                    return var14;<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private Long tryAcquire(long waitTime, long leaseTime, TimeUnit unit, long threadId) {<br \/>\n        return (Long)this.get(this.tryAcquireAsync(waitTime, leaseTime, unit, threadId));<br \/>\n    } <\/p>\n<li>\n<p>\u9996\u6b21\u5c1d\u8bd5\u5148\u8c03\u7528\u00a0tryAcquire\u00a0\u5c1d\u8bd5\u83b7\u53d6\u9501\u3002\u5982\u679c\u6210\u529f&#xff08;\u8fd4\u56de\u00a0null&#xff09;&#xff0c;\u76f4\u63a5\u8fd4\u56de\u00a0true\u3002<\/p>\n<\/li>\n<li>\n<p>\u8ba2\u9605\u9501\u91ca\u653e\u4e8b\u4ef6\u5982\u679c\u9996\u6b21\u5c1d\u8bd5\u5931\u8d25&#xff0c;\u5c31\u901a\u8fc7\u00a0subscribe\u00a0\u8ba2\u9605\u8be5\u9501\u7684\u91ca\u653e\u901a\u77e5&#xff0c;\u907f\u514d\u65e0\u6548\u7684\u81ea\u65cb\u7b49\u5f85\u3002<\/p>\n<\/li>\n<li>\n<p>\u5faa\u73af\u91cd\u8bd5\u8fdb\u5165\u00a0do-while\u00a0\u5faa\u73af&#xff0c;\u53ea\u8981\u8fd8\u6709\u5269\u4f59\u7b49\u5f85\u65f6\u95f4&#xff0c;\u5c31\u4f1a&#xff1a;<\/p>\n<ul>\n<li>\u518d\u6b21\u8c03\u7528\u00a0tryAcquire\u00a0\u5c1d\u8bd5\u83b7\u53d6\u9501<\/li>\n<li>\u82e5\u6210\u529f\u5219\u8fd4\u56de\u00a0true<\/li>\n<li>\u82e5\u5931\u8d25&#xff0c;\u5c31\u7b49\u5f85\u9501\u91ca\u653e\u901a\u77e5\u6216\u5269\u4f59\u65f6\u95f4&#xff0c;\u7136\u540e\u7ee7\u7eed\u5faa\u73af<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8d85\u65f6\u9000\u51fa\u5982\u679c\u7b49\u5f85\u65f6\u95f4\u8017\u5c3d\u4ecd\u672a\u83b7\u53d6\u5230\u9501&#xff0c;\u5c31\u8c03\u7528\u00a0acquireFailed\u00a0\u5e76\u8fd4\u56de\u00a0false\u3002<\/p>\n<\/li>\n<li>\n<p>\u8d44\u6e90\u6e05\u7406\u65e0\u8bba\u6210\u529f\u8fd8\u662f\u5931\u8d25&#xff0c;\u6700\u7ec8\u90fd\u4f1a\u5728\u00a0finally\u00a0\u5757\u4e2d\u53d6\u6d88\u8ba2\u9605&#xff0c;\u907f\u514d\u8d44\u6e90\u6cc4\u6f0f\u3002<\/p>\n<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1278\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031011-6987fe9372eb3.png\" width=\"1850\" \/><\/p>\n<h2 style=\"background-color:transparent\">\u516d\u3001\u770b\u95e8\u72d7\u7b56\u7565<\/h2>\n<h3 style=\"background-color:transparent\">6.1 \u52a0\u9501<\/h3>\n<p>    private RFuture&lt;Boolean&gt; tryAcquireOnceAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId) {<br \/>\n        if (leaseTime !&#061; -1L) {<br \/>\n            return this.&lt;Boolean&gt;tryLockInnerAsync(waitTime, leaseTime, unit, threadId, RedisCommands.EVAL_NULL_BOOLEAN);<br \/>\n        } else {<br \/>\n            RFuture&lt;Boolean&gt; ttlRemainingFuture &#061; this.&lt;Boolean&gt;tryLockInnerAsync(waitTime, this.commandExecutor.getConnectionManager().getCfg().getLockWatchdogTimeout(), TimeUnit.MILLISECONDS, threadId, RedisCommands.EVAL_NULL_BOOLEAN);<br \/>\n            ttlRemainingFuture.onComplete((ttlRemaining, e) -&gt; {<br \/>\n                if (e &#061;&#061; null) {<br \/>\n                    if (ttlRemaining) {<br \/>\n                        this.scheduleExpirationRenewal(threadId);<br \/>\n                    }<\/p>\n<p>                }<br \/>\n            });<br \/>\n            return ttlRemainingFuture;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private void scheduleExpirationRenewal(long threadId) {<br \/>\n        ExpirationEntry entry &#061; new ExpirationEntry();<br \/>\n        ExpirationEntry oldEntry &#061; (ExpirationEntry)EXPIRATION_RENEWAL_MAP.putIfAbsent(this.getEntryName(), entry);<br \/>\n        if (oldEntry !&#061; null) {<br \/>\n            oldEntry.addThreadId(threadId);<br \/>\n        } else {<br \/>\n            entry.addThreadId(threadId);<br \/>\n            this.renewExpiration();<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>    private void renewExpiration() {<br \/>\n        ExpirationEntry ee &#061; (ExpirationEntry)EXPIRATION_RENEWAL_MAP.get(this.getEntryName());<br \/>\n        if (ee !&#061; null) {<br \/>\n            Timeout task &#061; this.commandExecutor.getConnectionManager().newTimeout(new TimerTask() {<br \/>\n                public void run(Timeout timeout) throws Exception {<br \/>\n                    ExpirationEntry ent &#061; (ExpirationEntry)RedissonLock.EXPIRATION_RENEWAL_MAP.get(RedissonLock.this.getEntryName());<br \/>\n                    if (ent !&#061; null) {<br \/>\n                        Long threadId &#061; ent.getFirstThreadId();<br \/>\n                        if (threadId !&#061; null) {<br \/>\n                            RFuture&lt;Boolean&gt; future &#061; RedissonLock.this.renewExpirationAsync(threadId);<br \/>\n                            future.onComplete((res, e) -&gt; {<br \/>\n                                if (e !&#061; null) {<br \/>\n                                    RedissonLock.log.error(&#034;Can&#039;t update lock &#034; &#043; RedissonLock.this.getName() &#043; &#034; expiration&#034;, e);<br \/>\n                                } else {<br \/>\n                                    if (res) {<br \/>\n                                        RedissonLock.this.renewExpiration();<br \/>\n                                    }<\/p>\n<p>                                }<br \/>\n                            });<br \/>\n                        }<br \/>\n                    }<br \/>\n                }<br \/>\n            }, this.internalLockLeaseTime \/ 3L, TimeUnit.MILLISECONDS);<br \/>\n            ee.setTimeout(task);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    protected RFuture&lt;Boolean&gt; renewExpirationAsync(long threadId) {<br \/>\n        return this.&lt;Boolean&gt;evalWriteAsync(this.getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, &#034;if (redis.call(&#039;hexists&#039;, KEYS[1], ARGV[2]) &#061;&#061; 1) then redis.call(&#039;pexpire&#039;, KEYS[1], ARGV[1]); return 1; end; return 0;&#034;, Collections.singletonList(this.getName()), this.internalLockLeaseTime, this.getLockName(threadId));<br \/>\n    } <\/p>\n<li>\n<p>\u5f00\u542f\u7eed\u547d\u5f53\u8c03\u7528\u00a0tryLock\u00a0\u4e14\u672a\u6307\u5b9a\u00a0leaseTime&#xff08;\u5373\u00a0leaseTime &#061; -1&#xff09;\u65f6&#xff0c;\u9501\u83b7\u53d6\u6210\u529f\u540e\u4f1a\u89e6\u53d1\u00a0scheduleExpirationRenewal&#xff0c;\u5f00\u542f\u770b\u95e8\u72d7\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u4efb\u52a1\u89e6\u53d1renewExpiration\u00a0\u65b9\u6cd5\u4f1a\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u9ed8\u8ba4\u5728\u9501\u8fc7\u671f\u65f6\u95f4\u7684 1\/3 \u65f6&#xff08;\u6bd4\u5982\u9501\u9ed8\u8ba4 30 \u79d2\u8fc7\u671f&#xff0c;\u4efb\u52a1\u5c31\u4f1a\u5728 10 \u79d2\u540e\u6267\u884c&#xff09;&#xff0c;\u53bb\u68c0\u67e5\u9501\u662f\u5426\u8fd8\u88ab\u5f53\u524d\u7ebf\u7a0b\u6301\u6709\u3002<\/p>\n<\/li>\n<li>\n<p>\u7eed\u547d\u64cd\u4f5c\u5b9a\u65f6\u4efb\u52a1\u4f1a\u8c03\u7528\u00a0renewExpirationAsync&#xff0c;\u901a\u8fc7 Lua \u811a\u672c\u53bb Redis \u4e2d\u66f4\u65b0\u9501\u7684\u8fc7\u671f\u65f6\u95f4&#xff0c;\u5b8c\u6210 \u201c\u7eed\u547d\u201d\u3002<\/p>\n<\/li>\n<li>\n<p>\u5faa\u73af\u7eed\u547d\u53ea\u8981\u9501\u8fd8\u88ab\u6301\u6709&#xff0c;\u6bcf\u6b21\u7eed\u547d\u6210\u529f\u540e&#xff0c;\u5c31\u4f1a\u518d\u6b21\u8c03\u5ea6\u4e0b\u4e00\u4e2a\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u5982\u6b64\u5faa\u73af&#xff0c;\u76f4\u5230\u9501\u88ab\u4e3b\u52a8\u91ca\u653e\u6216\u7ebf\u7a0b\u5d29\u6e83\u3002<\/p>\n<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1511\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031012-6987fe9450793.png\" width=\"2371\" \/><\/p>\n<p>\u5f53\u6211\u4eec\u4e0d\u6307\u5b9a\u9501\u8fc7\u671f\u65f6\u95f4&#xff0c;\u5c31\u4f1a\u6267\u884c\u770b\u95e8\u72d7\u7b56\u7565&#xff0c;\u4f1a\u4e00\u76f4\u5e2e\u6211\u4eec\u7eed\u671f<\/p>\n<p>\u601d\u8003&#xff1a;\u4e3a\u4ec0\u4e48\u4e0d\u5e72\u8106\u8bbe\u5b9a\u4e0d\u8fc7\u671f&#xff0c;\u800c\u662f\u8981\u91c7\u7528\u5b9a\u65f6\u4efb\u52a1\u4e0d\u65ad\u5730\u7eed\u671f&#xff1f;<\/p>\n<ul>\n<li>\u6ee1\u8db3\u957f\u4efb\u52a1\u9700\u6c42&#xff1a;\u6709\u4e9b\u4e1a\u52a1\u64cd\u4f5c&#xff08;\u6bd4\u5982\u6279\u91cf\u5904\u7406\u6570\u636e\u3001\u590d\u6742\u7684\u6570\u636e\u5e93\u4e8b\u52a1&#xff09;\u6267\u884c\u65f6\u95f4\u4e0d\u786e\u5b9a&#xff0c;\u53ef\u80fd\u8d85\u8fc7\u9501\u7684\u521d\u59cb\u8fc7\u671f\u65f6\u95f4&#xff08;\u9ed8\u8ba4 30 \u79d2&#xff09;&#xff0c;\u5982\u679c\u9501\u63d0\u524d\u8fc7\u671f&#xff0c;\u4f1a\u5bfc\u81f4\u591a\u4e2a\u5ba2\u6237\u7aef\u540c\u65f6\u6301\u6709\u9501&#xff0c;\u7834\u574f\u5206\u5e03\u5f0f\u9501\u7684\u4e92\u65a5\u6027\u3002<\/li>\n<li>\u4fdd\u8bc1\u9501\u6700\u7ec8\u53ef\u91ca\u653e&#xff1a;\u5373\u4f7f\u5ba2\u6237\u7aef\u5f02\u5e38\u5d29\u6e83&#xff0c;\u770b\u95e8\u72d7\u7684\u7eed\u671f\u7ebf\u7a0b\u4e5f\u4f1a\u968f\u4e4b\u7ec8\u6b62&#xff0c;\u9501\u4f1a\u5728\u521d\u59cb\u8fc7\u671f\u65f6\u95f4&#xff08;\u6216\u6700\u540e\u4e00\u6b21\u7eed\u671f\u540e\u7684 30 \u79d2&#xff09;\u540e\u81ea\u52a8\u8fc7\u671f&#xff0c;\u907f\u514d\u6b7b\u9501<\/li>\n<\/ul>\n<h3 style=\"background-color:transparent\">6.2 \u91ca\u653e\u9501<\/h3>\n<p>    public RFuture&lt;Void&gt; unlockAsync(long threadId) {<br \/>\n        RPromise&lt;Void&gt; result &#061; new RedissonPromise();<br \/>\n        RFuture&lt;Boolean&gt; future &#061; this.unlockInnerAsync(threadId);<br \/>\n        future.onComplete((opStatus, e) -&gt; {<br \/>\n            this.cancelExpirationRenewal(threadId);<br \/>\n            if (e !&#061; null) {<br \/>\n                result.tryFailure(e);<br \/>\n            } else if (opStatus &#061;&#061; null) {<br \/>\n                IllegalMonitorStateException cause &#061; new IllegalMonitorStateException(&#034;attempt to unlock lock, not locked by current thread by node id: &#034; &#043; this.id &#043; &#034; thread-id: &#034; &#043; threadId);<br \/>\n                result.tryFailure(cause);<br \/>\n            } else {<br \/>\n                result.trySuccess((Object)null);<br \/>\n            }<br \/>\n        });<br \/>\n        return result;<br \/>\n    }<\/p>\n<p>    void cancelExpirationRenewal(Long threadId) {<br \/>\n        ExpirationEntry task &#061; (ExpirationEntry)EXPIRATION_RENEWAL_MAP.get(this.getEntryName());<br \/>\n        if (task !&#061; null) {<br \/>\n            if (threadId !&#061; null) {<br \/>\n                task.removeThreadId(threadId);<br \/>\n            }<\/p>\n<p>            if (threadId &#061;&#061; null || task.hasNoThreads()) {<br \/>\n                Timeout timeout &#061; task.getTimeout();<br \/>\n                if (timeout !&#061; null) {<br \/>\n                    timeout.cancel();<br \/>\n                }<\/p>\n<p>                EXPIRATION_RENEWAL_MAP.remove(this.getEntryName());<br \/>\n            }<\/p>\n<p>        }<br \/>\n    } <\/p>\n<ul>\n<li>\n<p>\u89e3\u9501\u65f6\u4e3b\u52a8\u5173\u95ed\u5728\u00a0unlockAsync\u00a0\u65b9\u6cd5\u4e2d&#xff0c;\u89e3\u9501\u64cd\u4f5c\u5b8c\u6210\u540e\u4f1a\u7acb\u523b\u8c03\u7528\u00a0cancelExpirationRenewal&#xff0c;\u4e3b\u52a8\u5173\u95ed\u770b\u95e8\u72d7\u7684\u7eed\u547d\u4efb\u52a1\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ebf\u7a0b\u5b89\u5168\u7684\u6e05\u7406<\/p>\n<ul>\n<li>cancelExpirationRenewal\u00a0\u4f1a\u5148\u4ece\u00a0EXPIRATION_RENEWAL_MAP\u00a0\u4e2d\u83b7\u53d6\u5f53\u524d\u9501\u5bf9\u5e94\u7684\u770b\u95e8\u72d7\u4efb\u52a1&#xff08;ExpirationEntry&#xff09;\u3002<\/li>\n<li>\u7136\u540e\u4ece\u4efb\u52a1\u4e2d\u79fb\u9664\u5f53\u524d\u7ebf\u7a0b ID&#xff0c;\u8fd9\u662f\u4e3a\u4e86\u5904\u7406\u9501\u53ef\u91cd\u5165\u7684\u573a\u666f&#xff0c;\u53ea\u6709\u5f53\u6240\u6709\u6301\u6709\u8be5\u9501\u7684\u7ebf\u7a0b\u90fd\u89e3\u9501\u540e&#xff0c;\u624d\u4f1a\u771f\u6b63\u505c\u6b62\u770b\u95e8\u72d7\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u505c\u6b62\u5b9a\u65f6\u4efb\u52a1<\/p>\n<ul>\n<li>\u5f53\u4efb\u52a1\u4e2d\u6ca1\u6709\u4efb\u4f55\u7ebf\u7a0b\u6301\u6709\u9501\u65f6&#xff08;task.hasNoThreads()&#xff09;&#xff0c;\u4f1a\u53d6\u6d88\u770b\u95e8\u72d7\u7684\u5b9a\u65f6\u4efb\u52a1&#xff08;timeout.cancel()&#xff09;\u3002<\/li>\n<li>\u6700\u540e\u4ece\u00a0EXPIRATION_RENEWAL_MAP\u00a0\u4e2d\u79fb\u9664\u8be5\u4efb\u52a1&#xff0c;\u5f7b\u5e95\u6e05\u7406\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1605\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031013-6987fe95ec34d.png\" width=\"2707\" \/><\/p>\n<p>\u5b9a\u65f6\u4efb\u52a1\u4f1a\u5728\u89e3\u9501\u7684\u65f6\u5019\u53d6\u6d88\u6389&#xff0c;\u4e0d\u4f1a\u4e00\u76f4\u6267\u884c<\/p>\n<h2 style=\"background-color:transparent\">\u4e03\u3001Redisson\u9501\u5b9e\u73b0\u4e3b\u4ece\u4e0d\u4e00\u81f4\u95ee\u9898<\/h2>\n<p>redission\u63d0\u51fa\u6765\u4e86MutiLock\u9501&#xff0c;\u4f7f\u7528\u8fd9\u628a\u9501\u54b1\u4eec\u5c31\u4e0d\u4f7f\u7528\u4e3b\u4ece\u4e86&#xff0c;\u6bcf\u4e2a\u8282\u70b9\u7684\u5730\u4f4d\u90fd\u662f\u4e00\u6837\u7684&#xff0c; \u8fd9\u628a\u9501\u52a0\u9501\u7684\u903b\u8f91\u9700\u8981\u5199\u5165\u5230\u6bcf\u4e00\u4e2a\u4e3b\u4e1b\u8282\u70b9\u4e0a&#xff0c;\u53ea\u6709\u6240\u6709\u7684\u670d\u52a1\u5668\u90fd\u5199\u5165\u6210\u529f&#xff0c;\u6b64\u65f6\u624d\u662f\u52a0\u9501\u6210\u529f&#xff0c;\u5047\u8bbe\u73b0\u5728\u67d0\u4e2a\u8282\u70b9\u6302\u4e86&#xff0c;\u90a3\u4e48\u4ed6\u53bb\u83b7\u5f97\u9501\u7684\u65f6\u5019&#xff0c;\u53ea\u8981\u6709\u4e00\u4e2a\u8282\u70b9\u62ff\u4e0d\u5230&#xff0c;\u90fd\u4e0d\u80fd\u7b97\u662f\u52a0\u9501\u6210\u529f&#xff0c;\u5c31\u4fdd\u8bc1\u4e86\u52a0\u9501\u7684\u53ef\u9760\u6027\u3002<\/p>\n<h3 style=\"background-color:transparent\">7.1 \u4ee3\u7801\u5b9e\u73b0<\/h3>\n<p>&#064;Configuration<br \/>\npublic class RedissonConfig {<\/p>\n<p>    &#064;Bean<br \/>\n    public RedissonClient redissonClient(){<br \/>\n        \/\/ \u914d\u7f6e<br \/>\n        Config config &#061; new Config();<br \/>\n        config.useSingleServer().setAddress(&#034;\u5730\u5740&#034;)<br \/>\n            .setPassword(&#034;\u5bc6\u7801&#034;);<br \/>\n        \/\/ \u521b\u5efaRedissonClient\u5bf9\u8c61<br \/>\n        return Redisson.create(config);<br \/>\n    }<\/p>\n<p>    &#064;Bean<br \/>\n    public RedissonClient redissonClient2(){<br \/>\n        \/\/ \u914d\u7f6e<br \/>\n        Config config &#061; new Config();<br \/>\n        config.useSingleServer().setAddress(&#034;\u5730\u5740&#034;)<br \/>\n            .setPassword(&#034;\u5bc6\u7801&#034;);<br \/>\n        \/\/ \u521b\u5efaRedissonClient\u5bf9\u8c61<br \/>\n        return Redisson.create(config);<br \/>\n    }<\/p>\n<p>    &#064;Bean<br \/>\n    public RedissonClient redissonClient3(){<br \/>\n        \/\/ \u914d\u7f6e<br \/>\n        Config config &#061; new Config();<br \/>\n        config.useSingleServer().setAddress(&#034;\u5730\u5740&#034;)<br \/>\n            .setPassword(&#034;\u5bc6\u7801&#034;);<br \/>\n        \/\/ \u521b\u5efaRedissonClient\u5bf9\u8c61<br \/>\n        return Redisson.create(config);<br \/>\n    }<br \/>\n}<br \/>\n    &#064;Override<br \/>\n    &#064;Transactional<br \/>\n    public Long seckillVoucher(Long voucherId) {<br \/>\n        \/\/ 1.\u67e5\u8be2\u4f18\u60e0\u5238<br \/>\n        SeckillVoucher voucher &#061; seckillVoucherService.getById(voucherId);<br \/>\n        \/\/ 2.\u5224\u65ad\u79d2\u6740\u662f\u5426\u5f00\u59cb<br \/>\n        if (voucher.getBeginTime().isAfter(LocalDateTime.now())) {<br \/>\n            \/\/ \u5c1a\u672a\u5f00\u59cb<br \/>\n            throw new BaseException(ExceptionConstants.NOT_START);<br \/>\n        }<br \/>\n        \/\/ 3.\u5224\u65ad\u79d2\u6740\u662f\u5426\u5df2\u7ecf\u7ed3\u675f<br \/>\n        if (voucher.getEndTime().isBefore(LocalDateTime.now())) {<br \/>\n            \/\/ \u5c1a\u672a\u5f00\u59cb<br \/>\n            throw new BaseException(ExceptionConstants.IS_END);<br \/>\n        }<br \/>\n        \/\/ 4.\u5224\u65ad\u5e93\u5b58\u662f\u5426\u5145\u8db3<br \/>\n        if (voucher.getStock() &lt; 1) {<br \/>\n            \/\/ \u5e93\u5b58\u4e0d\u8db3<br \/>\n            throw new BaseException(ExceptionConstants.NOT_ENOUGH);<br \/>\n        }<br \/>\n        Long userId &#061; UserHolder.getUser().getId();<br \/>\n        String key &#061; RedisConstants.getLockOrderKey(userId);<br \/>\n        RLock lock1 &#061; redissonClient.getLock(key);<br \/>\n        RLock lock2 &#061; redissonClient2.getLock(key);<br \/>\n        RLock lock3 &#061; redissonClient3.getLock(key);<br \/>\n        RLock lock &#061; redissonClient.getMultiLock(lock1 , lock2 , lock3);<br \/>\n        boolean isLock &#061; lock.tryLock();<br \/>\n        if (!isLock) {<br \/>\n            \/\/ \u83b7\u53d6\u9501\u5931\u8d25&#xff0c;\u8fd4\u56de\u9519\u8bef\u6216\u91cd\u8bd5<br \/>\n            throw new BaseException(ExceptionConstants.EXIST_BUY);<br \/>\n        }<br \/>\n        try {<br \/>\n            IVoucherOrderService proxy &#061; (IVoucherOrderService) AopContext.currentProxy();<br \/>\n            return proxy.createVoucherOrder(voucherId);<br \/>\n        } catch (IllegalStateException e) {<br \/>\n            throw new RuntimeException(e);<br \/>\n        } finally {<br \/>\n            lock.unlock();<br \/>\n        }<br \/>\n    } <\/p>\n<h3 style=\"background-color:transparent\">7.2 \u6e90\u7801<\/h3>\n<p>    public RLock getMultiLock(RLock&#8230; locks) {<br \/>\n        return new RedissonMultiLock(locks);<br \/>\n    }<br \/>\n    final List&lt;RLock&gt; locks &#061; new ArrayList();<\/p>\n<p>    public RedissonMultiLock(RLock&#8230; locks) {<br \/>\n        if (locks.length &#061;&#061; 0) {<br \/>\n            throw new IllegalArgumentException(&#034;Lock objects are not defined&#034;);<br \/>\n        } else {<br \/>\n            this.locks.addAll(Arrays.asList(locks));<br \/>\n        }<br \/>\n    } <\/p>\n<h3 style=\"background-color:transparent\">7.3 \u52a0\u9501<\/h3>\n<p>    public boolean tryLock() {<br \/>\n        try {<br \/>\n            return this.tryLock(-1L, -1L, (TimeUnit)null);<br \/>\n        } catch (InterruptedException var2) {<br \/>\n            Thread.currentThread().interrupt();<br \/>\n            return false;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    public boolean tryLock(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException {<br \/>\n        long newLeaseTime &#061; -1L;<br \/>\n        if (leaseTime !&#061; -1L) {<br \/>\n            if (waitTime &#061;&#061; -1L) {<br \/>\n                newLeaseTime &#061; unit.toMillis(leaseTime);<br \/>\n            } else {<br \/>\n                newLeaseTime &#061; unit.toMillis(waitTime) * 2L;<br \/>\n            }<br \/>\n        }<\/p>\n<p>        long time &#061; System.currentTimeMillis();<br \/>\n        long remainTime &#061; -1L;<br \/>\n        if (waitTime !&#061; -1L) {<br \/>\n            remainTime &#061; unit.toMillis(waitTime);<br \/>\n        }<\/p>\n<p>        long lockWaitTime &#061; this.calcLockWaitTime(remainTime);<br \/>\n        int failedLocksLimit &#061; this.failedLocksLimit();<br \/>\n        List&lt;RLock&gt; acquiredLocks &#061; new ArrayList(this.locks.size());<br \/>\n        ListIterator&lt;RLock&gt; iterator &#061; this.locks.listIterator();<\/p>\n<p>        while(iterator.hasNext()) {<br \/>\n            RLock lock &#061; (RLock)iterator.next();<\/p>\n<p>            boolean lockAcquired;<br \/>\n            try {<br \/>\n                if (waitTime &#061;&#061; -1L &amp;&amp; leaseTime &#061;&#061; -1L) {<br \/>\n                    lockAcquired &#061; lock.tryLock();<br \/>\n                } else {<br \/>\n                    long awaitTime &#061; Math.min(lockWaitTime, remainTime);<br \/>\n                    lockAcquired &#061; lock.tryLock(awaitTime, newLeaseTime, TimeUnit.MILLISECONDS);<br \/>\n                }<br \/>\n            } catch (RedisResponseTimeoutException var21) {<br \/>\n                this.unlockInner(Arrays.asList(lock));<br \/>\n                lockAcquired &#061; false;<br \/>\n            } catch (Exception var22) {<br \/>\n                lockAcquired &#061; false;<br \/>\n            }<\/p>\n<p>            if (lockAcquired) {<br \/>\n                acquiredLocks.add(lock);<br \/>\n            } else {<br \/>\n                if (this.locks.size() &#8211; acquiredLocks.size() &#061;&#061; this.failedLocksLimit()) {<br \/>\n                    break;<br \/>\n                }<\/p>\n<p>                if (failedLocksLimit &#061;&#061; 0) {<br \/>\n                    this.unlockInner(acquiredLocks);<br \/>\n                    if (waitTime &#061;&#061; -1L) {<br \/>\n                        return false;<br \/>\n                    }<\/p>\n<p>                    failedLocksLimit &#061; this.failedLocksLimit();<br \/>\n                    acquiredLocks.clear();<\/p>\n<p>                    while(iterator.hasPrevious()) {<br \/>\n                        iterator.previous();<br \/>\n                    }<br \/>\n                } else {<br \/>\n                    &#8211;failedLocksLimit;<br \/>\n                }<br \/>\n            }<\/p>\n<p>            if (remainTime !&#061; -1L) {<br \/>\n                remainTime -&#061; System.currentTimeMillis() &#8211; time;<br \/>\n                time &#061; System.currentTimeMillis();<br \/>\n                if (remainTime &lt;&#061; 0L) {<br \/>\n                    this.unlockInner(acquiredLocks);<br \/>\n                    return false;<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        if (leaseTime !&#061; -1L) {<br \/>\n            List&lt;RFuture&lt;Boolean&gt;&gt; futures &#061; new ArrayList(acquiredLocks.size());<\/p>\n<p>            for(RLock rLock : acquiredLocks) {<br \/>\n                RFuture&lt;Boolean&gt; future &#061; ((RedissonLock)rLock).expireAsync(unit.toMillis(leaseTime), TimeUnit.MILLISECONDS);<br \/>\n                futures.add(future);<br \/>\n            }<\/p>\n<p>            for(RFuture&lt;Boolean&gt; rFuture : futures) {<br \/>\n                rFuture.syncUninterruptibly();<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return true;<br \/>\n    } <\/p>\n<li>\u591a\u8282\u70b9\u72ec\u7acb\u52a0\u9501\u5411\u591a\u4e2a\u72ec\u7acb\u7684 Redis \u8282\u70b9\u53d1\u8d77\u52a0\u9501\u8bf7\u6c42&#xff0c;\u8fd9\u4e9b\u8282\u70b9\u4e4b\u95f4\u6ca1\u6709\u4e3b\u4ece\u5173\u7cfb&#xff0c;\u90fd\u662f\u72ec\u7acb\u7684\u5b9e\u4f8b\u3002<\/li>\n<li>\u5931\u8d25\u65f6\u56de\u6eda\u5982\u679c\u52a0\u9501\u5931\u8d25&#xff0c;\u4f1a\u7acb\u523b\u91ca\u653e\u6240\u6709\u5df2\u7ecf\u6210\u529f\u52a0\u9501\u7684\u8282\u70b9&#xff0c;\u907f\u514d\u51fa\u73b0\u9501\u6b8b\u7559\u3002<\/li>\n<h3 style=\"background-color:transparent\">7.4 \u6d41\u7a0b\u56fe<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1588\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031016-6987fe98983b5.png\" width=\"2642\" \/><\/p>\n<h2 style=\"background-color:transparent\">\u516b\u3001\u540e\u7eed\u5185\u5bb9<\/h2>\n<p>\u76ee\u524d\u6211\u4eec\u7684\u6d41\u7a0b\u8fd8\u662f\u4e32\u884c\u6267\u884c\u7684&#xff0c;\u6027\u80fd\u4e0d\u662f\u5f88\u597d&#xff0c;\u6211\u4eec\u5728\u4e0b\u4e00\u7bc7\u8fdb\u884c\u5f02\u6b65\u4f18\u5316<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u524d\u7f6e\u5185\u5bb9<br \/>\n1.1 \u5355\u673a\u79d2\u6740\u5b9e\u73b0<br \/>\n\u57fa\u4e8e Redis \u7684\u79d2\u6740\u5355\u673a\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2<br \/>\n1.2 SETNX\u5b9e\u73b0\u96c6\u7fa4\u6a21\u5f0f\u4e0b<br \/>\n\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010SETNX\u3011&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2<br \/>\n1.3 \u524d\u7f6e\u6d41\u7a0b\u56fe\u00a0<br \/>\n1.4 \u524d\u7f6e\u95ee\u9898<br \/>\n\u7528SETNX\u5b9e\u73b0\u7684\u9501&#xff0c;\u6709\u4e0d\u53ef\u91cd\u5165&#xff0c;\u4e0d\u53ef\u91cd\u8bd5&#xff0c;\u9501\u8fc7\u671f&#xff0c;\u4e3b\u4ece\u4e0d\u4e00\u81f4\u7684\u95ee\u9898<br \/>\n\u4e8c\u3001Redis<\/p>\n","protected":false},"author":2,"featured_media":73760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7095,99,105,101,292,100,4647],"topic":[],"class_list":["post-73770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-7095","tag-java","tag-redis","tag-spring","tag-292","tag-100","tag-4647"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/73770.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u524d\u7f6e\u5185\u5bb9 1.1 \u5355\u673a\u79d2\u6740\u5b9e\u73b0 \u57fa\u4e8e Redis \u7684\u79d2\u6740\u5355\u673a\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2 1.2 SETNX\u5b9e\u73b0\u96c6\u7fa4\u6a21\u5f0f\u4e0b \u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010SETNX\u3011&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2 1.3 \u524d\u7f6e\u6d41\u7a0b\u56fe\u00a0 1.4 \u524d\u7f6e\u95ee\u9898 \u7528SETNX\u5b9e\u73b0\u7684\u9501&#xff0c;\u6709\u4e0d\u53ef\u91cd\u5165&#xff0c;\u4e0d\u53ef\u91cd\u8bd5&#xff0c;\u9501\u8fc7\u671f&#xff0c;\u4e3b\u4ece\u4e0d\u4e00\u81f4\u7684\u95ee\u9898 \u4e8c\u3001Redis\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/73770.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-08T03:10:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031006-6987fe8e1771d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73770.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/73770.html\",\"name\":\"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-08T03:10:20+00:00\",\"dateModified\":\"2026-02-08T03:10:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/73770.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/73770.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73770.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/73770.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u524d\u7f6e\u5185\u5bb9 1.1 \u5355\u673a\u79d2\u6740\u5b9e\u73b0 \u57fa\u4e8e Redis \u7684\u79d2\u6740\u5355\u673a\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2 1.2 SETNX\u5b9e\u73b0\u96c6\u7fa4\u6a21\u5f0f\u4e0b \u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010SETNX\u3011&#xff08;\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe&#xff09;-CSDN\u535a\u5ba2 1.3 \u524d\u7f6e\u6d41\u7a0b\u56fe\u00a0 1.4 \u524d\u7f6e\u95ee\u9898 \u7528SETNX\u5b9e\u73b0\u7684\u9501&#xff0c;\u6709\u4e0d\u53ef\u91cd\u5165&#xff0c;\u4e0d\u53ef\u91cd\u8bd5&#xff0c;\u9501\u8fc7\u671f&#xff0c;\u4e3b\u4ece\u4e0d\u4e00\u81f4\u7684\u95ee\u9898 \u4e8c\u3001Redis","og_url":"https:\/\/www.wsisp.com\/helps\/73770.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-08T03:10:20+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208031006-6987fe8e1771d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/73770.html","url":"https:\/\/www.wsisp.com\/helps\/73770.html","name":"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-08T03:10:20+00:00","dateModified":"2026-02-08T03:10:20+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/73770.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/73770.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/73770.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e Redis \u7684\u79d2\u6740\u96c6\u7fa4\u7cfb\u7edf\u8fed\u4ee3\u5b9e\u73b0\u3010Redisson\u6e90\u7801\u5206\u6790\u3011\uff08\u9644\u8be6\u7ec6\u6d41\u7a0b\u56fe\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=73770"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73770\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/73760"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=73770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=73770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=73770"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=73770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}