-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move instantiation to top-level functions. Use Lettuce's coroutines i…
…mplementation. Extract default GetNameStrategy to DefaultGetNameStrategy. Update README.md with more details and new instantiation.
- Loading branch information
Showing
10 changed files
with
105 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
kacheable-core/src/main/kotlin/com/github/dave08/kacheable/Kacheable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
kacheable-lettuce/src/main/kotlin/com/github/dave08/kacheable/RedisKacheableStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package com.github.dave08.kacheable | ||
|
||
import io.lettuce.core.ExperimentalLettuceCoroutinesApi | ||
import io.lettuce.core.api.StatefulRedisConnection | ||
import io.lettuce.core.api.coroutines | ||
import kotlinx.coroutines.future.await | ||
import kotlin.time.Duration | ||
|
||
@OptIn(ExperimentalLettuceCoroutinesApi::class) | ||
class RedisKacheableStore(private val conn: StatefulRedisConnection<String, String>) : KacheableStore { | ||
|
||
override suspend fun delete(key: String) { | ||
conn.async().del(key).await() | ||
conn.coroutines().del(key) | ||
} | ||
|
||
override suspend fun set(key: String, value: String) { | ||
conn.async().set(key, value).await() | ||
conn.coroutines().set(key, value) | ||
} | ||
|
||
override suspend fun get(key: String): String? = | ||
conn.async().get(key).await() | ||
override suspend fun get(key: String): String? = conn.coroutines().get(key) | ||
|
||
override suspend fun setExpire(key: String, expiry: Duration) { | ||
conn.async().pexpire(key, expiry.inWholeMilliseconds).await() | ||
conn.coroutines().pexpire(key, expiry.inWholeMilliseconds) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.