Redipper is a simple redis wrapper for Lettuce which makes it easier to use. The core features are:
- Definition of spaces over redis which gives a table-like feel over db.
- Generic collection API like Redisson.
- Automatic serialization of objects.
- Various encoders for compression and encryption.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.shahrivari</groupId>
<artifactId>redipper</artifactId>
<version>v1.28</version>
</dependency>
Create object of any classes on your demand.
val personCache = RedisMap.newBuilder<Person>(redisConfig, "person")
.withTtl(10, TimeUnit.SECONDS)
.withLoader { getPerson() }
.build()
personCache.set(person.id.toString(), personInstance)
personCache.get(person.id.toString())
If you have specific serializer, you can pass it to redisWrapper as described below:
val studentCache = RedisMap.newBuilder<Student>(redisConfig, "student")
.withTtl(10, TimeUnit.SECONDS)
.withLoader { getStudent() }
.withSerializer(StudentSerializer.build())
.build()
studentCache.set(student.id.toString(), studentInstance)
studentCache.get(student.id.toString())
Most of this code is written by Mohammad Hossein Liaghat and Mohammad Amin Badiezadegan.