package com.qs.mp.common.core.redis;

import org.redisson.api.RLock;

import java.util.concurrent.TimeUnit;

/**
 * @author Cup
 * @date 2022/5/18
 */
public interface DistributedLocker {

    RLock lock(String lockKey);

    RLock lock(String lockKey, long leaseTime);

    RLock lock(String lockKey, long leaseTime, TimeUnit unit);

    RLock getLock(String lockKey);

    boolean tryLock(String lockKey);

    boolean tryLock(String lockKey, long waitTime, long leaseTime, TimeUnit unit);

    void unlock(String lockKey);

    void unlock(RLock lock);

}
