public class ConfigBuilder extends Object implements Serializable
Config,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DATABASE
0
|
static String |
DEFAULT_HOST
localhost
|
static String |
DEFAULT_NAMESPACE
All resque clients use "resque" by default
|
static String |
DEFAULT_PASSWORD
null
|
static int |
DEFAULT_PORT
6379
|
static int |
DEFAULT_TIMEOUT
5 seconds
|
| Constructor and Description |
|---|
ConfigBuilder()
No-arg constructor
|
ConfigBuilder(Config startingPoint)
Create a new ConfigBuilder using an existing Config as the starting point.
|
| Modifier and Type | Method and Description |
|---|---|
Config |
build() |
static Config |
getDefaultConfig() |
ConfigBuilder |
withDatabase(int database)
Configs created by this ConfigBuilder will use the given Redis database.
|
ConfigBuilder |
withHost(String host)
Configs created by this ConfigBuilder will have the given Redis hostname.
|
ConfigBuilder |
withNamespace(String namespace)
Configs created by this ConfigBuilder will have the given Redis namespace to prefix keys with.
|
ConfigBuilder |
withPassword(String password)
Configs created by this ConfigBuilder will authenticate with the given Redis password.
|
ConfigBuilder |
withPort(int port)
Configs created by this ConfigBuilder will have the given Redis port number.
|
ConfigBuilder |
withTimeout(int timeout)
Configs created by this ConfigBuilder will have the given Redis connection timeout.
|
public static final String DEFAULT_HOST
public static final int DEFAULT_PORT
public static final int DEFAULT_TIMEOUT
public static final String DEFAULT_PASSWORD
public static final String DEFAULT_NAMESPACE
public static final int DEFAULT_DATABASE
public ConfigBuilder()
public ConfigBuilder(Config startingPoint)
startingPoint - the Config instance to copy the values frompublic static Config getDefaultConfig()
public ConfigBuilder withHost(String host)
host - the Redis hostnamepublic ConfigBuilder withPort(int port)
port - the Redis port numberpublic ConfigBuilder withTimeout(int timeout)
timeout - the Redis connection timeoutpublic ConfigBuilder withPassword(String password)
password - the Redis paswordpublic ConfigBuilder withNamespace(String namespace)
namespace - the Redis namespace to prefix keys withpublic ConfigBuilder withDatabase(int database)
database - the Redis database to usepublic Config build()
Copyright © 2011-2013. All Rights Reserved.