redis 分佈式鎖處理

 

import java.nio.charset.Charset;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisStringCommands;
import org.springframework.data.redis.connection.ReturnType;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.stereotype.Component;


@Component
public class RedisDistributedLockUtil {

    private final Logger logger = LoggerFactory.getLogger(RedisDistributedLockUtil.class);

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    private static final String UNLOCK_LUA;

//靜態代碼塊lua腳本   

 static {
        StringBuilder sb = new StringBuilder();
    

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章