public static class CacheConnection.Builder extends Connection.Builder
| Modifier and Type | Method and Description |
|---|---|
CacheConnection.Builder |
clientConfig(JedisClientConfig clientConfig) |
protected Connection |
createConnection()
Construct a fresh, uninitialized
Connection for this builder. |
Cache |
getCache() |
CacheConnection.Builder |
socketFactory(JedisSocketFactory socketFactory) |
build, getClientConfig, getSocketFactorypublic Cache getCache()
public CacheConnection.Builder socketFactory(JedisSocketFactory socketFactory)
socketFactory in class Connection.Builderpublic CacheConnection.Builder clientConfig(JedisClientConfig clientConfig)
clientConfig in class Connection.Builderprotected Connection createConnection()
Connection.BuilderConnection for this builder.
Template-method hook for subclasses to return their concrete Connection subtype
(see CacheConnection.Builder for an example). The
returned instance has its socket factory and client config wired up, but the network
handshake has not run yet.
Two callers drive initialization differently:
Connection.Builder.build() — the public entry point — invokes
Connection.initializeFromClientConfig() on the returned instance before
handing it back, so external callers receive a ready-to-use connection.Connection.Builder.buildUninitialized() — the package-private accessor used by pool
factories — returns the uninitialized instance so the factory can interpose
between construction and initialization (e.g. to track an in-flight handshake
so a forced disconnect can interrupt it).
Implementations must be free of side effects: do not open sockets, send commands, or
invoke Connection.initializeFromClientConfig() — running initialization here
would break the buildUninitialized() contract that pool factories rely on.
createConnection in class Connection.BuilderConnectionCopyright © 2026. All rights reserved.