https://github.com/jdekim43/lettuce-extension
https://github.com/jdekim43/lettuce-extension
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jdekim43/lettuce-extension
- Owner: jdekim43
- License: mit
- Created: 2020-02-04T06:32:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-04T08:02:34.000Z (over 4 years ago)
- Last Synced: 2025-01-19T07:13:21.188Z (5 months ago)
- Language: Kotlin
- Size: 74.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lettuce-extension
* StringCodec lettuce wrapper
* KeyPrefixStringCodec
* Redis Queue
* Redis Priority Queue## Install
### Gradle Project
1. Add dependency
```
build.gradle.kts
implementation("kr.jadekim:lettuce-extension:0.0.2")
```## How to use
### StringCodec lettuce wrapper
```
val redis = Redis(
host = "...",
port = 6379,
dbIndex = 0,
keyPrefix = "PREFIX:",
poolSize = 8 //pipe pool size
)redis.set("KEY1", "VALUE") // key = PREFIX:KEY1
```
### RedisQueue
```
data class QueueItem(
...
)val queue = RedisQueue(redis, "QUEUE", QueueItem::class.java)
//Operations
queue.size()
queue.isEmpty()
queue.pop()
queue.peek()
queue.push(QueueItem(...))
queue.push(listOf(QueueItem(...)))
queue.clear
```
### PriorityRedisQueue
```
data class QueueItem(
...
)val queue = RedisQueue(redis, "QUEUE", QueueItem::class.java)
val priority = 100.0
//Operations
queue.size()
queue.isEmpty()
queue.pop()
queue.peek()
queue.push(QueueItem(...), priority)
queue.push(QueueItem(...) to priority, QueueItem(...) to priority, ...)
queue.slice(start, stop)
queue.get(index)
queue.elements()
queue.extend(listOf(QueueItem(...) to priority))
queue.clear()
```