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();