Example usage for org.springframework.data.redis.core ValueOperations get

List of usage examples for org.springframework.data.redis.core ValueOperations get

Introduction

In this page you can find the example usage for org.springframework.data.redis.core ValueOperations get.

Prototype

@Nullable
V get(Object key);

Source Link

Document

Get the value of key .

Usage

From source file:com.pubkit.platform.persistence.impl.RedisDaoImpl.java

@Override
public String getUserAccessToken(String email) {
    ValueOperations<String, String> ops = this.redisTemplate.opsForValue();
    return ops.get(email);
}

From source file:com.easarrive.datasource.redis.etago.AbstractDaoByRedisTemplate.java

public V valueGet(K key) {
    ValueOperations<K, V> valueOperations = redisTemplate.opsForValue();
    V object = valueOperations.get(key);
    return object;
}

From source file:com.caronic.data.redis.SampleRedisApplication.java

@Override
public void run(String... args) throws Exception {
    ValueOperations<String, String> ops = template.opsForValue();
    String key = "spring.boot.redis.test";
    if (!template.hasKey(key)) {
        ops.set(key, "foo");
    }//from  ww  w.java  2 s .  com
    System.out.println("Found key " + key + ", value=" + ops.get(key));
}

From source file:com.miko.demo.mongo.service.RedisInitTest.java

@Test
public void testKeyValue() {
    RedisTemplate<String, Long> redis = new RedisTemplate<>();
    redis.setConnectionFactory(connectionFactory);
    redis.setKeySerializer(RedisStringSerializer.INSTANCE);
    redis.setValueSerializer(RedisLongSerializer.INSTANCE);
    redis.afterPropertiesSet();//from  ww  w  .  j av a2s. c  o m

    ValueOperations<String, Long> ops = redis.opsForValue();
    String key = "spring-postgresql:counter-test";

    Long value = ops.get(key);
    logger.debug("VALUE = " + value);

    assertThat(value, notNullValue());
}

From source file:com.miko.demo.postgresql.service.RedisInitTest.java

@Test
public void testKeyValue() {
    RedisTemplate<String, Long> redis = new RedisTemplate<>();
    redis.setConnectionFactory(connectionFactory);
    redis.setKeySerializer(RedisStringSerializer.INSTANCE);
    redis.setValueSerializer(RedisLongSerializer.INSTANCE);
    redis.afterPropertiesSet();//from  ww w  . j  a  v  a2  s  .c  o m

    ValueOperations<String, Long> ops = redis.opsForValue();
    String key = "miko-spring-postgresql:counter-test";

    Long value = ops.get(key);
    logger.debug("VALUE = " + value);

    assertThat(value, notNullValue());
}

From source file:com.miko.demo.mongo.service.RedisRemovalTest.java

@Test
public void removalKeyValueTest() {
    RedisTemplate<String, Long> redis = new RedisTemplate<>();
    redis.setConnectionFactory(connectionFactory);
    redis.setKeySerializer(RedisStringSerializer.INSTANCE);
    redis.setValueSerializer(RedisLongSerializer.INSTANCE);
    redis.afterPropertiesSet();/* w  ww. j  a v a 2s. co  m*/

    ValueOperations<String, Long> ops = redis.opsForValue();

    String key1 = "miko-spring-mongo:counter-test";
    String key2 = "miko-spring-mongo:counter-test-2";

    Set<String> keys = redis.keys(key1);
    for (String foundKey : keys) {
        logger.debug("Found Key= " + foundKey + " value= " + ops.get(foundKey));
    }

    redis.delete(key2);

}

From source file:com.miko.demo.postgresql.service.RedisRemovalTest.java

@Test
public void removalKeyValueTest() {
    RedisTemplate<String, Long> redis = new RedisTemplate<>();
    redis.setConnectionFactory(connectionFactory);
    redis.setKeySerializer(RedisStringSerializer.INSTANCE);
    redis.setValueSerializer(RedisLongSerializer.INSTANCE);
    redis.afterPropertiesSet();//from  w w w.  j  a v a2  s.co  m

    ValueOperations<String, Long> ops = redis.opsForValue();

    String key1 = "miko-spring-postgresql:counter-test";
    String key2 = "miko-spring-postgresql:counter-test-2";

    Set<String> keys = redis.keys(key1);
    for (String foundKey : keys) {
        logger.debug("Found Key= " + foundKey + " value= " + ops.get(foundKey));
    }

    redis.delete(key2);

}

From source file:com.company.project.service.dao.RedisDao.java

public Object get(String key) {
    ValueOperations opsForValue = redisTemplate.opsForValue();
    return opsForValue.get(key);
}

From source file:org.ednovo.gooru.service.ResourceCassandraServiceImpl.java

@Override
public String getRedisValue(String key) {
    ValueOperations<String, String> valueOperations = getValueOperation();
    return valueOperations.get(key);
}