Skip to content

Commit 05a5276

Browse files
committed
Update version to 0.0.4 and refine command handling logic
- Upgrade dependency references to 0.0.4 across all documentation and configuration files. - Optimize `DataStore` logic for TTL clearing and list removals. - Streamline `CommandHandler` by consolidating command enum entries.
1 parent 6b9805a commit 05a5276

7 files changed

Lines changed: 19 additions & 31 deletions

File tree

EXAMPLES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Note: Spring integration uses a SmartLifecycle adapter to manage RedisServer sta
8787
```kotlin
8888
dependencies {
8989
implementation("org.springframework.boot:spring-boot-starter")
90-
implementation("io.github.sudouser777:embedded-redis-server:0.0.3")
90+
implementation("io.github.sudouser777:embedded-redis-server:0.0.4")
9191
implementation("redis.clients:jedis:5.1.0")
9292
}
9393
```

PROJECT_SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- **Project Name**: Embedded Redis Server
66
- **Package**: `io.github.embeddedredis`
7-
- **Version**: 0.0.3
7+
- **Version**: 0.0.4
88
- **License**: Apache 2.0
99
- **GitHub**: https://github.com/sudouser777/embedded-redis-server
1010

QUICKSTART.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cd embedded-redis-server
2323
**Gradle:**
2424
```gradle
2525
dependencies {
26-
implementation 'io.github.sudouser777:embedded-redis-server:0.0.3'
26+
implementation 'io.github.sudouser777:embedded-redis-server:0.0.4'
2727
}
2828
```
2929

@@ -32,7 +32,7 @@ dependencies {
3232
<dependency>
3333
<groupId>io.github.sudouser777</groupId>
3434
<artifactId>embedded-redis-server</artifactId>
35-
<version>0.0.3</version>
35+
<version>0.0.4</version>
3636
</dependency>
3737
```
3838

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ A lightweight, embeddable Redis-compatible server written in Kotlin. Perfect for
6060

6161
```gradle
6262
dependencies {
63-
implementation 'io.github.sudouser777:embedded-redis-server:0.0.3'
63+
implementation 'io.github.sudouser777:embedded-redis-server:0.0.4'
6464
}
6565
```
6666

@@ -70,7 +70,7 @@ dependencies {
7070
<dependency>
7171
<groupId>io.github.sudouser777</groupId>
7272
<artifactId>embedded-redis-server</artifactId>
73-
<version>0.0.3</version>
73+
<version>0.0.4</version>
7474
</dependency>
7575
```
7676

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = 'io.github.sudouser777'
10-
version = '0.0.3'
10+
version = '0.0.4'
1111
description = 'Embedded Redis Server - A lightweight, embeddable Redis-compatible server for testing and development'
1212

1313
repositories {

src/main/kotlin/io/github/embeddedredis/CommandHandler.kt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,9 @@ class CommandHandler(private val dataStore: DataStore) {
1212

1313
private enum class CommandName {
1414
PING, ECHO, SET, GET, DEL, EXISTS, COMMAND, HELLO, SETNX, SETEX, HSET, HSETNX, HGET, HMGET, HINCRBY,
15-
LPUSH, RPUSH, LPOP, RPOP, LLEN, LMOVE, LRANGE, LTRIM,
16-
// List QoL
17-
LINDEX, LSET, LPUSHX, RPUSHX, LINSERT,
18-
// List remaining non-blocking
19-
LREM, RPOPLPUSH,
20-
// Hash completeness
21-
HDEL, HEXISTS, HLEN, HGETALL, HKEYS, HVALS,
22-
// Expiration related
23-
EXPIRE, PEXPIRE, PERSIST, TTL, PTTL,
24-
// String batch and counters
25-
MGET, MSET, INCR, DECR, INCRBY, DECRBY, GETSET,
26-
// Keyspace iteration
27-
SCAN;
15+
LPUSH, RPUSH, LPOP, RPOP, LLEN, LMOVE, LRANGE, LTRIM, LINDEX, LSET, LPUSHX, RPUSHX, LINSERT, LREM, RPOPLPUSH,
16+
HDEL, HEXISTS, HLEN, HGETALL, HKEYS, HVALS, EXPIRE, PEXPIRE, PERSIST, TTL, PTTL, MGET, MSET, INCR, DECR,
17+
INCRBY, DECRBY, GETSET, SCAN;
2818

2919
val lower: String
3020
get() = name.lowercase()
@@ -633,7 +623,7 @@ class CommandHandler(private val dataStore: DataStore) {
633623
throw IllegalArgumentException("value is not an integer or out of range")
634624
}
635625
var match: String? = null
636-
var count: Int = 10 // default
626+
var count = 10 // default
637627
var i = 2
638628
var seenMatch = false
639629
var seenCount = false

src/main/kotlin/io/github/embeddedredis/DataStore.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ class DataStore {
321321
newVal
322322
}
323323
existing.data is StoredValue.StringValue -> {
324-
old = (existing.data as StoredValue.StringValue).content
325-
// Clear TTL when setting new value
324+
old = existing.data.content
325+
// Clear TTL when setting a new value
326326
val newVal = Value(StoredValue.StringValue(value), null)
327327
synchronizeExpiration(key, newVal)
328328
newVal
@@ -764,14 +764,12 @@ class DataStore {
764764
}
765765
count > 0 -> {
766766
var remaining = count
767-
if (remaining > 0) {
768-
val it = deque.iterator()
769-
while (it.hasNext() && remaining > 0) {
770-
if (it.next() == value) {
771-
it.remove()
772-
removed++
773-
remaining--
774-
}
767+
val it = deque.iterator()
768+
while (it.hasNext() && remaining > 0) {
769+
if (it.next() == value) {
770+
it.remove()
771+
removed++
772+
remaining--
775773
}
776774
}
777775
}

0 commit comments

Comments
 (0)