feat: migrate from Lettuce to Redisson for Redis interactions#15
feat: migrate from Lettuce to Redisson for Redis interactions#15twisti-dev merged 71 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Redis client implementation from Lettuce to Redisson, modernizing connection management and adapting all Redis-backed features (event bus, request-response, cache, and sync structures) to use Redisson's reactive API.
Key Changes:
- Replaced Lettuce client with Redisson for connection management and pub/sub operations
- Updated all sync structures (list, map, set, value) to use Redisson's reactive Bucket and AtomicLong APIs
- Migrated event bus and request-response bus to Redisson's reactive topic API
- Refactored SimpleRedisCache to use Redisson's LocalCachedMap with Caffeine provider
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle.kts | Replaced Lettuce dependency with Redisson 4.0.0 |
| src/main/kotlin/dev/slne/surf/redis/RedisApi.kt | Migrated from Lettuce client to Redisson, updated connection management and health check APIs |
| src/main/kotlin/dev/slne/surf/redis/event/RedisEventBus.kt | Replaced Lettuce pub/sub listener with Redisson reactive topic subscription |
| src/main/kotlin/dev/slne/surf/redis/request/RequestResponseBus.kt | Updated to use Redisson reactive topics for request/response channels |
| src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt | Migrated to Redisson's LocalCachedMap with Caffeine caching |
| src/main/kotlin/dev/slne/surf/redis/sync/SyncStructure.kt | Updated base class to use Redisson reactive topic for pub/sub |
| src/main/kotlin/dev/slne/surf/redis/sync/value/SyncValue.kt | Migrated to Redisson reactive Bucket and AtomicLong for snapshot/version storage |
| src/main/kotlin/dev/slne/surf/redis/sync/set/SyncSet.kt | Migrated to Redisson reactive Bucket and AtomicLong for snapshot/version storage |
| src/main/kotlin/dev/slne/surf/redis/sync/map/SyncMap.kt | Migrated to Redisson reactive Bucket and AtomicLong for snapshot/version storage |
| src/main/kotlin/dev/slne/surf/redis/sync/list/SyncList.kt | Migrated to Redisson reactive Bucket and AtomicLong for snapshot/version storage |
| src/main/kotlin/dev/slne/surf/redis/util/util.kt | Added custom Mono extension functions for converting to Deferred |
|
@twisti-dev I've opened a new pull request, #16, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@codex update all kdocs from Lettuce mentions and references to redisson. Also ensure the docs are still correct and correct the invalid ones |
|
Summary
Testing
|
…r improved lazy initialization
|
@codex update all kdocs from Lettuce mentions and references to redisson. Also ensure the docs are still correct and correct the invalid ones |
|
@codex review |
|
Summary
Testing
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…edicated execute method
…mproved cleanup efficiency
… efficiency and handle empty states
…sets for improved cache management
…ve Lua script for improved performance
…rce type constraints for improved type safety
…ry configurations
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 70 out of 80 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (3)
surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt:188
- The comment states "UUID as string rather than byte array" but this change in serialization format could break compatibility with existing data. This breaking change should be clearly documented in the PR description or migration guide, as systems with existing Redis data will fail to deserialize UUIDs stored in the old format.
surf-redis-core/src/main/kotlin/dev/slne/surf/redis/util/KotlinSerializerCache.kt:7 - Changing the visibility from
internaltopublicexposes implementation details that were previously encapsulated. This breaks the API contract and could lead to misuse. Consider keeping it internal or clearly marking it with@InternalRedisAPIannotation if it needs to be accessible across modules.
surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt:242 - The
redisOsTypeis fetched but never used anywhere in the codebase. If this property serves no purpose, it should be removed. If it's intended for future use, that should be documented.
| val cache = api.redisson.getSetCache<String>("") as RedissonSetCache | ||
| cache.iterator() | ||
| cache.filter { true} |
There was a problem hiding this comment.
Lines 229-231 appear to be leftover debug/test code. These lines create an empty set cache and perform no-op operations that have no effect on the invalidateAll functionality. They should be removed.
|
|
||
| plugins { | ||
| id("dev.slne.surf.surfapi.gradle.core") | ||
| // id("dev.slne.surf.surfapi.gradle.standalone") /* Uncomment to use tests */ |
There was a problem hiding this comment.
Commented-out plugin configuration suggests incomplete migration or testing setup. Either enable the plugin for proper test execution or remove the comment if tests work without it.
This pull request introduces a major refactor of the
surf-redislibrary, replacing the Lettuce-based implementation with Redisson and updating the project structure to support a multi-module Gradle build. The changes also remove the old configuration system and update documentation to reflect the new architecture and APIs.Migration from Lettuce to Redisson and Project Modularization:
RedisApiand related classes. The API now usesRedissonClientandRedissonReactiveClientinstead of Lettuce'sRedisClientand connections. (surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt, [1] [2] [3] [4] [5] [6] [7]README.mdto reference Redisson instead of Lettuce, and clarified threading model references throughout. (README.md, [1] [2] [3] [4] [5] [6] [7] [8]Configuration and Dependency Management:
GlobalConfig.kt,LocalConfig.kt,InternalConfig.kt) in favor of a new credentials provider and simplified configuration, since plugin path-based config is no longer relevant. [1] [2] [3]surf-redis-api,surf-redis-paper,surf-redis-velocity, andsurf-redis-core. Updatedsettings.gradle.ktsand added a newbuild.gradle.ktsforsurf-redis-apiwith updated dependencies for Redisson and test containers. [1] [2]Deprecations and API Changes:
RedisApi.createmethod, since the library is no longer shaded into plugins and does not require plugin-specific paths. (surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt, surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.ktR143-R168)surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt, surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.ktR143-R168)These changes modernize the library, improve maintainability, and align the implementation with current best practices for Kotlin and Redis integration.