jedis helper

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

The Artistic License 2.0
Categories

Categories

Ant Build Tools Jedis Data Databases
GroupId

GroupId

com.github.phantomthief
ArtifactId

ArtifactId

jedis-helper
Last Version

Last Version

0.1.15
Release Date

Release Date

Type

Type

jar
Description

Description

jedis helper
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

https://github.com/PhantomThief/jedis-helper
Source Code Management

Source Code Management

https://github.com/PhantomThief/jedis-helper.git

Download jedis-helper

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.phantomthief/jedis-helper/ -->
<dependency>
    <groupId>com.github.phantomthief</groupId>
    <artifactId>jedis-helper</artifactId>
    <version>0.1.15</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.phantomthief/jedis-helper/
implementation 'com.github.phantomthief:jedis-helper:0.1.15'
// https://jarcasting.com/artifacts/com.github.phantomthief/jedis-helper/
implementation ("com.github.phantomthief:jedis-helper:0.1.15")
'com.github.phantomthief:jedis-helper:jar:0.1.15'
<dependency org="com.github.phantomthief" name="jedis-helper" rev="0.1.15">
  <artifact name="jedis-helper" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.phantomthief', module='jedis-helper', version='0.1.15')
)
libraryDependencies += "com.github.phantomthief" % "jedis-helper" % "0.1.15"
[com.github.phantomthief/jedis-helper "0.1.15"]

Dependencies

compile (7)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.24
redis.clients : jedis jar 2.9.0
com.google.guava : guava jar 20.0
com.carrotsearch : hppc jar 0.7.1
com.github.phantomthief : cursor-iterator jar 1.0.8
com.github.phantomthief : more-lambdas jar 0.1.8
com.google.code.findbugs : jsr305 Optional jar 3.0.2

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar
org.junit.jupiter : junit-jupiter-engine jar
com.github.fppt : jedis-mock jar 0.1.16
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

jedis-helper

Build Status Coverage Status Total alerts Language grade: Java Maven Central

关于jedis的一些工具类的封装

基本使用

// 声明
JedisHelper jedisHelper = JedisHelper.newBuilder(JedisPool::new).build();

// 使用
Collection<Integer> ids = Arrays.asList(1, 2, 3);

// pipeline调用
jedisHelper.pipeline(p -> {
    p.zadd("key1", 1D, "value1");
    p.zadd("key2", 1D, "value2");
});

// pipeline调用
Map<Integer, Map<String, String>> result1 = jedisHelper.pipeline(ids, (p, id) -> p.hmget("key_" + id));

// pipeline调用+转码
Map<Integer, Long> result2 = jedisHelper.pipeline(ids, (p, id) -> p.get("key2_" + id), NumberUtils::toLong);

// 单次命令调用
jedisHelper.get().get("key"); // 直接调用,不需要先从池中获得Jedis,再return回去

// Scan调用
Stream<Tuple> stream = jedisHelper.zscan("zsetKey");

高级使用

  • ShardBitSet:把一个大的bitset打散成多个小key存储,减少内存开销,并在一定程度上提高性能(不过计算整个命名空间上的bitcount以及迭代遍历所有bitset性能会降低)。

Versions

Version
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0