mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
d981be8cd1
commit
11bf2c3743
@ -1,7 +1,10 @@
|
|||||||
package cn.hutool.cache;
|
package cn.hutool.cache;
|
||||||
|
|
||||||
import cn.hutool.cache.impl.LRUCache;
|
import cn.hutool.cache.impl.LRUCache;
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@ -13,6 +16,18 @@ import java.util.concurrent.CountDownLatch;
|
|||||||
*/
|
*/
|
||||||
public class LRUCacheTest {
|
public class LRUCacheTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void putTest(){
|
||||||
|
//https://github.com/dromara/hutool/issues/2227
|
||||||
|
LRUCache<String, String> cache = CacheUtil.newLRUCache(100, 10);
|
||||||
|
for (int i = 0; i < 10000; i++) {
|
||||||
|
//ThreadUtil.execute(()-> cache.put(RandomUtil.randomString(5), "1243", 10));
|
||||||
|
ThreadUtil.execute(()-> cache.get(RandomUtil.randomString(5), ()->RandomUtil.randomString(10)));
|
||||||
|
}
|
||||||
|
ThreadUtil.sleep(3000);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readWriteTest() throws InterruptedException {
|
public void readWriteTest() throws InterruptedException {
|
||||||
LRUCache<Integer, Integer> cache = CacheUtil.newLRUCache(10);
|
LRUCache<Integer, Integer> cache = CacheUtil.newLRUCache(10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user