本文整理汇总了Java中com.lambdaworks.redis.RedisConnection类的典型用法代码示例。如果您正苦于以下问题:Java RedisConnection类的具体用法?Java RedisConnection怎么用?Java RedisConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedisConnection类属于com.lambdaworks.redis包,在下文中一共展示了RedisConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: clientKillExtended
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Test
public void clientKillExtended() {
RedisConnection<String, String> connection2 = client.connect().sync();
connection2.clientSetname("killme");
Pattern p = Pattern.compile("^.*addr=([^ ]+).*name=killme.*$", Pattern.MULTILINE | Pattern.DOTALL);
String clients = redis.clientList();
Matcher m = p.matcher(clients);
assertThat(m.matches()).isTrue();
String addr = m.group(1);
assertThat(redis.clientKill(KillArgs.Builder.addr(addr).skipme())).isGreaterThan(0);
assertThat(redis.clientKill(KillArgs.Builder.id(4234))).isEqualTo(0);
assertThat(redis.clientKill(KillArgs.Builder.typeSlave().id(4234))).isEqualTo(0);
assertThat(redis.clientKill(KillArgs.Builder.typeNormal().id(4234))).isEqualTo(0);
assertThat(redis.clientKill(KillArgs.Builder.typePubsub().id(4234))).isEqualTo(0);
connection2.close();
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:22,代码来源:ServerCommandTest.java
示例2: testCreate
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Test
public void testCreate() throws Exception {
RedisConnection<String, String> connection = PoolingProxyFactory.create(client.pool());
connection.set("a", "b");
connection.close();
try {
connection.set("x", "y");
fail("missing exception");
} catch (RedisException e) {
assertThat(e.getMessage()).isEqualTo("Connection pool is closed");
}
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:17,代码来源:PoolingProxyFactoryTest.java
示例3: testLettuce
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@POST
@Path("testLettuce")
public void testLettuce(String jsonString) {
RedisClient redisClient = RedisClient.create("redis://localhost:6379/0");
RedisConnection<String, String> conn1 = redisClient.connect();
conn1.set("foo", "bar");
String value = conn1.get("foo");
System.out.println(value);
conn1.close();
redisClient.shutdown();
RedisClient client = RedisClient.create("redis://localhost:6379/0");
RedisAsyncConnection<String, String> conn = client.connectAsync();
conn.set("foo", "bar");
conn.get("foo");
conn.lpush("lll", "a");
conn.lpush("lll", "b");
conn.lpush("lll", "c");
conn.lpop("lll");
conn.lpop("lll");
conn.lpop("lll");
conn.hset("mmm", "abc", "123");
conn.hset("mmm", "def", "456");
conn.hgetall("mmm");
conn.del("foo", "lll", "mmm");
conn.close();
client.shutdown();
}
开发者ID:uavorg,项目名称:uavstack,代码行数:37,代码来源:TestRestService.java
示例4: lettucetest
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@GET
@Path("lettucetest")
@Produces(MediaType.TEXT_HTML + ";charset=utf-8")
public String lettucetest() {
System.out.println("TEST Lettuce sync ======================================================");
RedisClient redisClient = RedisClient.create("redis://localhost:6379/0");
RedisConnection<String, String> conn = redisClient.connect();
conn.set("foo", "bar");
conn.get("foo");
conn.lpush("lll", "a");
conn.lpush("lll", "b");
conn.lpush("lll", "c");
conn.lpop("lll");
conn.lpop("lll");
conn.lpop("lll");
conn.hset("mmm", "abc", "123");
conn.hset("mmm", "def", "456");
conn.hgetall("mmm");
conn.del("foo", "lll", "mmm");
conn.close();
redisClient.shutdown();
return "lettucetest";
}
开发者ID:uavorg,项目名称:uavstack,代码行数:31,代码来源:RedisService.java
示例5: testSync
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
private static void testSync() {
System.out.println("TEST Lettuce sync ======================================================");
RedisClient redisClient = RedisClient.create("redis://localhost:6379/0");
RedisConnection<String, String> conn = redisClient.connect();
System.out.println("Connected to Redis");
conn.set("foo", "bar");
String value = conn.get("foo");
System.out.println(value);
conn.close();
redisClient.shutdown();
}
开发者ID:uavorg,项目名称:uavstack,代码行数:16,代码来源:DoTestLettuceHookProxy.java
示例6: getRedisConnectionFactory
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
private Factory<RedisConnection> getRedisConnectionFactory() {
final ConnectionConfig.RedisConnectionConfig connectionConfig = (ConnectionConfig.RedisConnectionConfig) cacheConfig.getConnectionConfig();
if (connectionConfig != null) {
if (connectionConfig.getPool() != null) {
return new RedisConnectionPoolFactory(RedisClient.create(getRedisUri()), getRedisCodec());
} else {
return new RedisConnectionFactory(RedisClient.create(getRedisUri()), getRedisCodec());
}
}
return null;
}
开发者ID:hortonworks,项目名称:registry,代码行数:13,代码来源:RedisCacheServiceBuilder.java
示例7: watch
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Test
public void watch() {
assertThat(redis.watch(key)).isEqualTo("OK");
RedisConnection<String, String> redis2 = client.connect().sync();
redis2.set(key, value + "X");
redis2.close();
redis.multi();
redis.append(key, "foo");
assertThat(redis.exec()).isEqualTo(list());
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:14,代码来源:TransactionCommandTest.java
示例8: testCreateDefault
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Test
public void testCreateDefault() throws Exception {
RedisConnectionPool<RedisCommands<String, String>> pool = client.pool();
RedisConnection<String, String> connection = PoolingProxyFactory.create(pool);
connection.set("a", "b");
connection.set("x", "y");
pool.close();
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:12,代码来源:PoolingProxyFactoryTest.java
示例9: testCloseReturnsConnection
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Test
public void testCloseReturnsConnection() throws Exception {
RedisConnectionPool<RedisCommands<String, String>> pool = client.pool();
assertThat(pool.getNumActive()).isEqualTo(0);
RedisConnection<String, String> connection = pool.allocateConnection();
assertThat(pool.getNumActive()).isEqualTo(1);
connection.close();
assertThat(pool.getNumActive()).isEqualTo(0);
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:11,代码来源:PoolingProxyFactoryTest.java
示例10: Builder
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public Builder(String id, TypeConfig.Cache cacheType, Factory<RedisConnection<K,V>> connFactory) {
super(id, cacheType);
this.connFactory = connFactory;
}
开发者ID:hortonworks,项目名称:registry,代码行数:5,代码来源:RedisCacheService.java
示例11: getConnFactory
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public Factory<RedisConnection<K, V>> getConnFactory() {
return connFactory;
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisCacheService.java
示例12: RedisAbstractCache
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public RedisAbstractCache(RedisConnection<K, V> redisConnection) {
this(redisConnection, null);
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisAbstractCache.java
示例13: RedisStringsCache
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public RedisStringsCache(RedisConnection<K, V> redisConnection) {
this(redisConnection, null);
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisStringsCache.java
示例14: RedisHashesCache
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public RedisHashesCache(RedisConnection<K, V> redisConnection, K key) {
this(redisConnection, key, null);
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisHashesCache.java
示例15: create
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public RedisConnection<K, V> create() {
return redisClient.pool(codec, MAX_IDLE, MAX_ACTIVE).allocateConnection();
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisConnectionPoolFactory.java
示例16: create
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
@Override
public RedisConnection<K, V> create() {
return redisClient.connect(codec);
}
开发者ID:hortonworks,项目名称:registry,代码行数:5,代码来源:RedisConnectionFactory.java
示例17: getConnection
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public static RedisConnection<String, String> getConnection() {
return connection;
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisCacheTestMain.java
示例18: getConnection1
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public static RedisConnection<String, String> getConnection1() {
return connection1;
}
开发者ID:hortonworks,项目名称:registry,代码行数:4,代码来源:RedisCacheTestMain.java
示例19: getRedisChannelHandler
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public static <K, V> RedisChannelHandler<K, V> getRedisChannelHandler(RedisConnection<K, V> sync) {
InvocationHandler invocationHandler = Proxy.getInvocationHandler(sync);
return (RedisChannelHandler<K, V>) ReflectionTestUtils.getField(invocationHandler, "connection");
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:6,代码来源:Connections.java
示例20: getRedis
import com.lambdaworks.redis.RedisConnection; //导入依赖的package包/类
public RedisConnection<String, String> getRedis() {
return redis;
}
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:4,代码来源:RedisDatabase.java
注:本文中的com.lambdaworks.redis.RedisConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论