migrate-jedis
Migrating from Jedis to Valkey GLIDE (Java)
Use when migrating a Java application from Jedis to the GLIDE client library.
Routing
- String, hash, list, set, sorted set, delete, exists, cluster, error handling -> API Mapping
- Pipeline, transaction, Batch API, MULTI/EXEC -> Advanced Patterns
- PubSub, subscribe, publish, JedisPubSub -> Advanced Patterns
- Spring Data Valkey, Spring Boot -> Advanced Patterns
Key Differences
| Area | Jedis | GLIDE |
|---|---|---|
| API model | Synchronous, returns values directly | Async - returns CompletableFuture, call .get() for sync |
| Configuration | JedisPool / JedisPoolConfig | GlideClientConfiguration.builder() |
| Connection model | Thread-per-connection pool | Single multiplexed connection per node |
| Multi-arg commands | Varargs: del("k1", "k2") | Array args: del(new String[]{"k1", "k2"}) |
| Expiry | Separate methods: setex(), psetex() | SetOptions.builder().expiry(Seconds(60L)) |
| Conditional SET | Separate setnx() | SetOptions.builder().conditionalSetOnlyIfNotExist() |
| Transactions | Transaction (extends Pipeline) | Batch(true) for atomic, Batch(false) for pipeline |
Migration Paths
Path 1: Jedis Compatibility Layer (Zero-Code-Change)
Drop-in wrapper implementing the Jedis API backed by GLIDE (GLIDE 2.1+). Add io.valkey:valkey-glide-jedis-compatibility and swap the classpath - existing redis.clients.jedis.Jedis code works without recompile.
Supported (GLIDE 2.3): Core string/hash/list/set, streams, sorted sets, geospatial, scripting/functions, ACL, server management, transactions (WATCH/MULTI/EXEC - see gotchas). Not yet supported: PubSub (JedisPubSub callbacks, sharded PubSub), pipelining (use native Batch API), CommandArguments/IParams builder pattern.
Path 2: Full Native Migration
Migrate directly to the GLIDE native API for full feature access. See the API Mapping and Advanced Patterns reference files.
Quick Start - Connection Setup
Jedis:
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(10);
JedisPool pool = new JedisPool(poolConfig, "localhost", 6379);
try (Jedis jedis = pool.getResource()) { jedis.ping(); }
GLIDE:
GlideClientConfiguration config = GlideClientConfiguration.builder()
.address(NodeAddress.builder().host("localhost").port(6379).build())
.requestTimeout(5000)
.build();
try (GlideClient client = GlideClient.createClient(config).get()) { client.ping().get(); }
No connection pool configuration needed - GLIDE uses a single multiplexed connection.
Configuration Mapping
| Jedis parameter | GLIDE equivalent |
|---|---|
| JedisPool(host, port) | NodeAddress.builder().host().port().build() |
| JedisPoolConfig.setMaxTotal() | Not needed - single multiplexed connection |
| password | ServerCredentials.builder().password().build() |
| database | databaseId() |
| ssl = true | useTLS(true) |
| timeout (ms) | requestTimeout() (ms) |
Incremental Migration Strategy
For native GLIDE migration (not using the compatibility layer):
- Add the
valkey-glideMaven/Gradle dependency alongside Jedis - Create a repository or DAO abstraction layer if one does not already exist
- Migrate one DAO implementation at a time from Jedis to GLIDE
- Replace
JedisPool.getResource()calls with the GLIDE client - no pool management needed - Add
.get()calls on all commands since GLIDE returnsCompletableFuture<T> - Run integration tests after each DAO migration
- Remove the Jedis dependency once all implementations are migrated
- Review
best-practices/production.mdfor timeout tuning, connection management, and observability setup
For the zero-code-change path using the Jedis compatibility layer, see the Migration Paths section above.
Reference
| Topic | File |
|---|---|
| Command-by-command API mapping (strings, hashes, lists, sets, sorted sets, delete, exists, cluster, errors) | api-mapping |
| Transactions, pipelines, Pub/Sub, Spring Data Valkey alternative | advanced-patterns |
See Also
- valkey-glide-java skill - full GLIDE Java API details
- Batching (see valkey-glide skill) - pipeline and transaction patterns
- TLS and authentication (see valkey-glide skill) - TLS setup and credential management
- Production deployment (see valkey-glide skill) - timeout tuning, connection management, observability
Gotchas
- Every command returns CompletableFuture. Call .get() for synchronous behavior.
- Array args, not varargs. Multi-key commands take String[] arrays, not varargs.
- No connection pool management. Drop JedisPool and JedisPoolConfig entirely.
- Builder pattern everywhere. Configuration, set options, and batch options all use the builder pattern.
- Batch replaces Transaction and Pipeline. Use new Batch(true) for atomic and new Batch(false) for non-atomic.
- Classifier required in Maven/Gradle. Use os-maven-plugin or osdetector-gradle-plugin. An uber JAR (GLIDE 2.3+) bundles all native libraries.
- Compatibility layer gotchas. After calling
multi(), use the returnedTransactionobject.HashSet<byte[]>operations degrade to O(n) becausebyte[].hashCode()returns identity hash. - No Sentinel support. GLIDE does not support Redis Sentinel - use cluster mode or direct connection.
More from avifenesh/valkey-skills
valkey
Use when building apps with Valkey - caching, sessions, queues, locks, rate-limiting, leaderboards, counters, pub-sub, streams, scripting. Covers IFEQ/DELIFEQ, hash field TTL, COMMANDLOG. Not for server internals (valkey-dev) or ops (valkey-ops).
5valkey-ops
Use when deploying, configuring, monitoring, or troubleshooting self-hosted Valkey. Covers Sentinel, cluster, persistence, replication, security, Kubernetes, performance tuning. Not for app development (valkey) or server internals (valkey-dev).
5valkey-ecosystem
Use when evaluating the Valkey ecosystem - client libraries, modules (JSON, Bloom, Search), managed services (AWS, GCP, Aiven), monitoring tools, frameworks (Spring, Django, Rails), Docker/Kubernetes deployment, CI/CD patterns, migration from Redis, and developer tooling.
5glide-mq
Use when building message queues with glide-mq. Covers queue setup, producer/consumer patterns, job scheduling, workflows, batch processing, streaming, and suspend/resume. Not for migrating from BullMQ (migrate-bullmq) or Bee-Queue (migrate-bee).
4valkey-glide
Router for Valkey GLIDE per-language skills. Use when you need to find the right language-specific GLIDE skill or migration skill. Not for GLIDE library internals or contributing to GLIDE source code - use glide-dev instead.
4migrate-go-redis
Use when migrating Go from go-redis to Valkey GLIDE. Covers Result[T] nil handling, CGO dependency, PubSub, SetWithOptions, Alpine/MUSL gotchas. Not for greenfield Go apps - use valkey-glide-go instead.
1