Skip to content

feat: migrate from Lettuce to Redisson for Redis interactions#15

Merged
twisti-dev merged 71 commits intomasterfrom
feat/redisson
Jan 14, 2026
Merged

feat: migrate from Lettuce to Redisson for Redis interactions#15
twisti-dev merged 71 commits intomasterfrom
feat/redisson

Conversation

@twisti-dev
Copy link
Copy Markdown
Contributor

@twisti-dev twisti-dev commented Dec 29, 2025

This pull request introduces a major refactor of the surf-redis library, 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:

  • Replaced all Lettuce Redis client usage with Redisson, including connection management, event bus, and request/response handling in RedisApi and related classes. The API now uses RedissonClient and RedissonReactiveClient instead of Lettuce's RedisClient and connections. (surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt, [1] [2] [3] [4] [5] [6] [7]
  • Updated all documentation in README.md to 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:

  • Removed the old configuration system (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]
  • Added a new Gradle submodule structure, creating modules for surf-redis-api, surf-redis-paper, surf-redis-velocity, and surf-redis-core. Updated settings.gradle.kts and added a new build.gradle.kts for surf-redis-api with updated dependencies for Redisson and test containers. [1] [2]

Deprecations and API Changes:

These changes modernize the library, improve maintainability, and align the implementation with current best practices for Kotlin and Redis integration.

@twisti-dev twisti-dev self-assigned this Dec 29, 2025
Copilot AI review requested due to automatic review settings December 29, 2025 21:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/main/kotlin/dev/slne/surf/redis/sync/SyncStructure.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/list/SyncList.kt Outdated
Comment thread surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/map/SyncMap.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/set/SyncSet.kt Outdated
Comment thread surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/set/SyncSet.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/value/SyncValue.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 29, 2025

@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.

@twisti-dev
Copy link
Copy Markdown
Contributor Author

@codex update all kdocs from Lettuce mentions and references to redisson. Also ensure the docs are still correct and correct the invalid ones

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Updated SyncStructure KDoc to reference Redisson reactive I/O and Pub/Sub threading, removing outdated Lettuce mentions.

Testing

  • ⚠️ Not run (documentation-only change).

View task →

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 10 comments.

Comment thread src/main/kotlin/dev/slne/surf/redis/sync/list/SyncList.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/value/SyncValue.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/util/util.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/event/RedisEventBus.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/map/SyncMap.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/RedisApi.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/sync/set/SyncSet.kt Outdated
Copilot AI review requested due to automatic review settings December 30, 2025 08:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Comment thread surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/util/util.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/cache/SimpleRedisCache.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/redis/RedisApi.kt
Copilot AI review requested due to automatic review settings December 30, 2025 14:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Comment thread src/main/kotlin/dev/slne/surf/redis/RedisApi.kt Outdated
Comment thread surf-redis-api/src/main/kotlin/dev/slne/surf/redis/util/util.kt
@twisti-dev
Copy link
Copy Markdown
Contributor Author

@codex update all kdocs from Lettuce mentions and references to redisson. Also ensure the docs are still correct and correct the invalid ones

@twisti-dev
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Updated SyncStructure KDoc to reference Redisson reactive APIs and correct Pub/Sub threading details.

Testing

  • ⚠️ Not run (documentation-only change).

View task →

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Copilot AI review requested due to automatic review settings January 7, 2026 20:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 70 out of 80 changed files in this pull request and generated no new comments.

…rce type constraints for improved type safety
Copilot AI review requested due to automatic review settings January 11, 2026 21:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 70 out of 80 changed files in this pull request and generated no new comments.

@twisti-dev twisti-dev marked this pull request as ready for review January 14, 2026 16:44
Copilot AI review requested due to automatic review settings January 14, 2026 16:44
@twisti-dev twisti-dev merged commit 8e5348f into master Jan 14, 2026
@twisti-dev twisti-dev deleted the feat/redisson branch January 14, 2026 16:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 internal to public exposes 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 @InternalRedisAPI annotation if it needs to be accessible across modules.
    surf-redis-api/src/main/kotlin/dev/slne/surf/redis/RedisApi.kt:242
  • The redisOsType is 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.

Comment on lines +229 to +231
val cache = api.redisson.getSetCache<String>("") as RedissonSetCache
cache.iterator()
cache.filter { true}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

plugins {
id("dev.slne.surf.surfapi.gradle.core")
// id("dev.slne.surf.surfapi.gradle.standalone") /* Uncomment to use tests */
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants