本文整理了Java中com.lambdaworks.redis.RedisClient.connect
方法的一些代码示例,展示了RedisClient.connect
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.connect
方法的具体详情如下:
包路径:com.lambdaworks.redis.RedisClient
类名称:RedisClient
方法名:connect
[英]Open a new synchronous connection to the redis server that treats keys and values as UTF-8 strings.
[中]打开到redis服务器的新同步连接,该服务器将密钥和值视为UTF-8字符串。
代码示例来源:origin: QNJR-GROUP/EasyTransaction
public RedisAsyncCommanderProvider(String uri){
RedisClient client = RedisClient.create(uri);
StatefulRedisConnection<String, byte[]> connect = client.connect(getCodec());
cmd = connect.async();
}
代码示例来源:origin: alibaba/jetcache
public StatefulConnection connection(AbstractRedisClient redisClient) {
LettuceObjects lo = getLettuceObjectsFromMap(redisClient);
if (lo.connection == null) {
if (redisClient instanceof RedisClient) {
lo.connection = ((RedisClient) redisClient).connect(new JetCacheCodec());
} else if (redisClient instanceof RedisClusterClient) {
lo.connection = ((RedisClusterClient) redisClient).connect(new JetCacheCodec());
} else {
throw new CacheConfigException("type " + redisClient.getClass() + " is not supported");
}
}
return lo.connection;
}
代码示例来源:origin: com.hortonworks.registries/cache
@Override
public RedisConnection<K, V> create() {
return redisClient.connect(codec);
}
}
代码示例来源:origin: hortonworks/registry
@Override
public RedisConnection<K, V> create() {
return redisClient.connect(codec);
}
}
代码示例来源:origin: danhyun/modern-java-web
@Provides
@Singleton
public StatefulRedisConnection<String, String> asyncCommands(RedisClient client) {
return client.connect();
}
代码示例来源:origin: com.hortonworks.registries/cache
private static void setConnection() {
// RedisClient redisClient = RedisClient.create(new RedisURI("127.0.0.1", 6379, 10L, TimeUnit.SECONDS));
RedisClient redisClient = RedisClient.create("redis://127.0.0.1:6379");
// RedisClient redisClient = RedisClient.create(new RedisURI.Builder.redis("127.0.0.1", 6379).build());
connection = redisClient.connect();
connection1 = redisClient.connect();
}
代码示例来源:origin: hortonworks/registry
private static void setConnection() {
// RedisClient redisClient = RedisClient.create(new RedisURI("127.0.0.1", 6379, 10L, TimeUnit.SECONDS));
RedisClient redisClient = RedisClient.create("redis://127.0.0.1:6379");
// RedisClient redisClient = RedisClient.create(new RedisURI.Builder.redis("127.0.0.1", 6379).build());
connection = redisClient.connect();
connection1 = redisClient.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: com.lambdaworks/lettuce
/**
* Open a new synchronous connection to the redis server that treats
* keys and values as UTF-8 strings.
*
* @return A new connection.
*/
public RedisConnection<String, String> connect() {
return connect(new Utf8StringCodec());
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: wg/lettuce
/**
* Open a new synchronous connection to the redis server that treats
* keys and values as UTF-8 strings.
*
* @return A new connection.
*/
public RedisConnection<String, String> connect() {
return connect(new Utf8StringCodec());
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: udacity/ud381
@Override
public void prepare(
Map map,
TopologyContext topologyContext,
OutputCollector outputCollector)
{
// instantiate a redis connection
RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection
redis = client.connect();
}
代码示例来源:origin: apache/apex-malhar
@Override
public void connect() throws IOException
{
client = new RedisClient(host, port);
connection = client.connect();
connection.select(dbIndex);
}
代码示例来源:origin: org.apache.apex/malhar-contrib
@Override
public void connect() throws IOException
{
client = new RedisClient(host, port);
connection = client.connect();
connection.select(dbIndex);
}
代码示例来源:origin: yahoo/sherlock
@Override
public <K> RedisConnection<K> produce(RedisCodec<K, K> codec) {
return new RedisConnectionImpl<>(Client.get().getRedisClient().connect(codec));
}
}
内容来源于网络,如有侵权,请联系作者删除!