更新时间:2024-10-23 GMT+08:00
分享

Jedis、Lettuce

直接替换客户端。
import com.huawei.devspore.mas.Redis.adapter.model.SetParams;
import com.huawei.devspore.mas.Redis.core.MultiZoneClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DemoService{
    @Autowired
    private MultiZoneClient client;
    public void set() {
        client.set("lock", "", SetParams.builder().hasNx(true).ex(30L).build());
    }
}

相关文档