Example usage for org.springframework.data.redis.connection StringRedisConnection exists

List of usage examples for org.springframework.data.redis.connection StringRedisConnection exists

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection StringRedisConnection exists.

Prototype

@Nullable
Long exists(String... keys);

Source Link

Document

Count how many of the given keys exist.

Usage

From source file:org.springframework.data.redis.connection.jredis.JRedisConnectionIntegrationTests.java

@Test
public void testMove() {
    connection.set("foo", "bar");
    actual.add(connection.move("foo", 1));
    verifyResults(Arrays.asList(new Object[] { true }));
    // JRedis does not support select() on existing conn, create new one
    JredisConnectionFactory factory2 = new JredisConnectionFactory();
    factory2.setDatabase(1);//from w  w w .  j a va 2s . co  m
    factory2.afterPropertiesSet();
    StringRedisConnection conn2 = new DefaultStringRedisConnection(factory2.getConnection());
    try {
        assertEquals("bar", conn2.get("foo"));
    } finally {
        if (conn2.exists("foo")) {
            conn2.del("foo");
        }
        conn2.close();
    }
}