Examples of StringRedisSerializer


Examples of org.springframework.data.redis.serializer.StringRedisSerializer

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Test
  public void testExecuteStatusResult() {
    this.template = new RedisTemplate<String, Long>();
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new GenericToStringSerializer<Long>(Long.class));
    template.setConnectionFactory(connFactory);
    template.afterPropertiesSet();
    DefaultRedisScript script = new DefaultRedisScript();
    script.setScriptText("return redis.call('SET',KEYS[1], ARGV[1])");
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

  @SuppressWarnings("unchecked")
  @Test
  public void testExecuteCustomResultSerializer() {
    JacksonJsonRedisSerializer<Person> personSerializer = new JacksonJsonRedisSerializer<Person>(Person.class);
    this.template = new RedisTemplate<String, Person>();
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(personSerializer);
    template.setConnectionFactory(connFactory);
    template.afterPropertiesSet();
    DefaultRedisScript<String> script = new DefaultRedisScript<String>();
    script.setScriptSource(new StaticScriptSource("redis.call('SET',KEYS[1], ARGV[1])\nreturn 'FOO'"));
    script.setResultType(String.class);
    ScriptExecutor<String> scriptExecutor = new DefaultScriptExecutor<String>(template);
    Person joe = new Person("Joe", "Schmoe", 23);
    String result = scriptExecutor.execute(script, personSerializer, new StringRedisSerializer(),
        Collections.singletonList("bar"), joe);
    assertEquals("FOO", result);
    assertEquals(joe, template.boundValueOps("bar").get());
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    final DefaultRedisScript<String> script = new DefaultRedisScript<String>();
    script.setScriptText("return 'Hey'");
    script.setResultType(String.class);
    assertEquals(
        "Hey",
        redisTemplate.execute(script, redisTemplate.getValueSerializer(), new StringRedisSerializer(),
            Collections.singletonList(key1)));
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    this.name = name;
    this.template = template;
    this.prefix = prefix;
    this.expiration = expiration;

    StringRedisSerializer stringSerializer = new StringRedisSerializer();

    // name of the set holding the keys
    this.setName = stringSerializer.serialize(name + "~keys");
    this.cacheLockName = stringSerializer.serialize(name + "~lock");
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    RedisTemplate<String, String> stringTemplate = new StringRedisTemplate();
    stringTemplate.setConnectionFactory(jedisConnectionFactory);
    stringTemplate.afterPropertiesSet();

    RedisTemplate<String, Long> longTemplate = new RedisTemplate<String, Long>();
    longTemplate.setKeySerializer(new StringRedisSerializer());
    longTemplate.setValueSerializer(new GenericToStringSerializer<Long>(Long.class));
    longTemplate.setConnectionFactory(jedisConnectionFactory);
    longTemplate.afterPropertiesSet();

    RedisTemplate<String, Double> doubleTemplate = new RedisTemplate<String, Double>();
    doubleTemplate.setKeySerializer(new StringRedisSerializer());
    doubleTemplate.setValueSerializer(new GenericToStringSerializer<Double>(Double.class));
    doubleTemplate.setConnectionFactory(jedisConnectionFactory);
    doubleTemplate.afterPropertiesSet();

    RedisTemplate<byte[], byte[]> rawTemplate = new RedisTemplate<byte[], byte[]>();
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

   * @param connection Redis connection
   */
  public DefaultStringRedisConnection(RedisConnection connection) {
    Assert.notNull(connection, "connection is required");
    this.delegate = connection;
    this.serializer = new StringRedisSerializer();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.