release branch 0.0.1

This commit is contained in:
binbin.hou
2020-09-10 14:03:35 +08:00
parent 3a8c68a19d
commit 8efc7db9c7
9 changed files with 134 additions and 10 deletions

View File

@@ -0,0 +1,22 @@
package com.github.houbb.lock.test;
import org.junit.Assert;
import org.junit.Test;
import redis.clients.jedis.Jedis;
/**
* @author binbin.hou
* @since 0.0.1
*/
public class JedisTest {
@Test
public void helloTest() {
Jedis jedis = new Jedis("127.0.0.1", 6379);
jedis.set("key", "001");
String value = jedis.get("key");
Assert.assertEquals("001", value);
}
}

View File

@@ -0,0 +1,35 @@
package com.github.houbb.lock.test;
import com.github.houbb.lock.api.core.ILock;
import com.github.houbb.lock.redis.bs.LockRedisBs;
import com.github.houbb.lock.redis.support.operator.IOperator;
import com.github.houbb.lock.redis.support.operator.impl.JedisOperator;
import org.junit.Test;
import redis.clients.jedis.Jedis;
/**
* @author binbin.hou
* @since 0.0.1
*/
public class RedisLockTest {
@Test
public void helloTest() {
Jedis jedis = new Jedis("127.0.0.1", 6379);
IOperator operator = new JedisOperator(jedis);
// 获取锁
ILock lock = LockRedisBs.newInstance().operator(operator).lock();
try {
boolean lockResult = lock.tryLock();
System.out.println(lockResult);
// 业务处理
} catch (Exception e) {
e.printStackTrace();
} finally {
lock.unlock();
}
}
}

View File

@@ -0,0 +1 @@
package com.github.houbb.lock.test;