当前位置: 首页>>代码示例>>Java>>正文


Java RedisClient.shutdown方法代码示例

本文整理汇总了Java中com.lambdaworks.redis.RedisClient.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java RedisClient.shutdown方法的具体用法?Java RedisClient.shutdown怎么用?Java RedisClient.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lambdaworks.redis.RedisClient的用法示例。


在下文中一共展示了RedisClient.shutdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAsync

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
private static void testAsync() {

        System.out.println("TEST Lettuce async ======================================================");
        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,代码行数:26,代码来源:DoTestLettuceHookProxy.java

示例2: insertionRemoval

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
@Test
public void insertionRemoval() throws NumberFormatException, InterruptedException, ExecutionException {
	RedisClient redis = RedisClient.create("redis://127.0.0.1:6379");
	StatefulRedisConnection<String, String> redisConn = redis.connect();
	RedisAsyncCommands<String, String> redisCmd = redisConn.async();
	
	long iterations = 1000;
	
	for (long i = 0; i < iterations; i++) {
		redisCmd.set(String.valueOf(i), String.valueOf(i + 1));
	}
	
	for (long i = 0; i < iterations; i++) {
		long v = Long.valueOf(redisCmd.get(String.valueOf(i)).get());
		assertEquals(i + 1, v);
	}
	
	for (long i = 0; i < iterations; i++) {
		redisCmd.del(String.valueOf(i));
	}
	
	redisConn.close();
	redis.shutdown();
}
 
开发者ID:3Cores,项目名称:sostream,代码行数:25,代码来源:TestRedisLettuce.java

示例3: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: redis://[[email protected]]host[:port][/databaseNumber]
        RedisClient redisClient = RedisClient.create();

        List<RedisURI> nodes = Arrays.asList(RedisURI.create("redis://host1"),
                RedisURI.create("redis://host2"),
                RedisURI.create("redis://host3"));

        StatefulRedisMasterSlaveConnection<String, String> connection = MasterSlave
                .connect(redisClient, new Utf8StringCodec(), nodes);
        connection.setReadFrom(ReadFrom.MASTER_PREFERRED);

        System.out.println("Connected to Redis");

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:19,代码来源:ConnectToMasterSlaveUsingElastiCacheCluster.java

示例4: testLettuce

import com.lambdaworks.redis.RedisClient; //导入方法依赖的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

示例5: lettucetest

import com.lambdaworks.redis.RedisClient; //导入方法依赖的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

示例6: lettuceAsyncTest

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
@GET
@Path("lettuce_async_test")
@Produces(MediaType.TEXT_HTML + ";charset=utf-8")
public String lettuceAsyncTest() {

    System.out.println("TEST Lettuce async ======================================================");
    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();
    return "lettuce_async_test";
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:30,代码来源:RedisService.java

示例7: testSync

import com.lambdaworks.redis.RedisClient; //导入方法依赖的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

示例8: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: redis://[[email protected]]host[:port][/databaseNumber]
        RedisClient redisClient = RedisClient.create("redis://[email protected]:6379/0");
        StatefulRedisConnection<String, String> connection = redisClient.connect();

        System.out.println("Connected to Redis");

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:12,代码来源:ConnectToRedis.java

示例9: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    // Syntax: redis-sentinel://[[email protected]]host[:port][,host2[:port2]][/databaseNumber]#sentinelMasterId
    RedisClient redisClient = RedisClient.create();

    StatefulRedisMasterSlaveConnection<String, String> connection = MasterSlave.connect(redisClient, new Utf8StringCodec(),
            RedisURI.create("redis-sentinel://localhost:26379,localhost:26380/0#mymaster"));
    connection.setReadFrom(ReadFrom.MASTER_PREFERRED);

    System.out.println("Connected to Redis");

    connection.close();
    redisClient.shutdown();
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:14,代码来源:ConnectToMasterSlaveUsingRedisSentinel.java

示例10: destroy

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
@Override
public void destroy(RedisClient instance, CreationalContext<RedisClient> creationalContext) {
    instance.shutdown();
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:5,代码来源:RedisClientCdiBean.java

示例11: destroyInstance

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
@Override
protected void destroyInstance(RedisClient instance) throws Exception {
    instance.shutdown();
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:5,代码来源:RedisClientFactoryBean.java

示例12: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: redis://[[email protected]]host[:port][/databaseNumber]

        DefaultClientResources clientResources = DefaultClientResources.builder() //
                .dnsResolver(new DirContextDnsResolver()) // Does not cache DNS lookups
                .build();

        RedisClient redisClient = RedisClient.create(clientResources, "redis://[email protected]:6379/0");
        StatefulRedisConnection<String, String> connection = redisClient.connect();

        System.out.println("Connected to Redis");

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:17,代码来源:ConnectToElastiCacheMaster.java

示例13: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: redis://[[email protected]]host[:port][/databaseNumber]
        RedisClient redisClient = RedisClient.create(RedisURI.create("redis://[email protected]:6379/0"));

        StatefulRedisConnection<String, String> connection = redisClient.connect();

        System.out.println("Connected to Redis");

        RedisCommands<String, String> sync = connection.sync();

        sync.set("foo", "bar");
        String value = sync.get("foo");
        System.out.println(value);

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:19,代码来源:ReadWriteExample.java

示例14: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: rediss://[[email protected]]host[:port][/databaseNumber]
        // Adopt the port to the stunnel port in front of your Redis instance
        RedisClient redisClient = RedisClient.create("rediss://[email protected]:6443/0");

        StatefulRedisConnection<String, String> connection = redisClient.connect();

        System.out.println("Connected to Redis using SSL");

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:14,代码来源:ConnectToRedisSSL.java

示例15: main

import com.lambdaworks.redis.RedisClient; //导入方法依赖的package包/类
public static void main(String[] args) {

        // Syntax: redis-sentinel://[[email protected]]host[:port][,host2[:port2]][/databaseNumber]#sentinelMasterId
        RedisClient redisClient = RedisClient.create("redis-sentinel://localhost:26379,localhost:26380/0#mymaster");

        StatefulRedisConnection<String, String> connection = redisClient.connect();

        System.out.println("Connected to Redis using Redis Sentinel");

        connection.close();
        redisClient.shutdown();
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:13,代码来源:ConnectToRedisUsingRedisSentinel.java


注:本文中的com.lambdaworks.redis.RedisClient.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。