Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
127.0.0.1:6379> get key
"\xd0\xa1\xd1\x8c\xd0\xb4\xd1\x94 \xd0\xbb\xd1\x94\xd0\xb6\xd0\xb8\xd1\x82\xd1\x8a \xd0\x9c\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8\xd1\x87\xd1\x8c \xd1\x87\xd1\x80\xd1\x8c\xd0\xb3\xd0\xbe\xd1\xb5\xd0\xb1\xd1\x8a\xc9\xaa\xd0\xbb\xd1\x8f \xd0\xb1\xd1\x8a\xc9\xaa\xd0\xb2\xd1\x8a\xc9\xaa\xd0\xb8 \xd0\xbf\xd1\x80\xd0\xb8 \xd0\xa1\xd1\xb5\xd0\xbc\xd0\xb5\xd0\xbe\xd0\xbd\xd1\xa3 \xd1\x86\xd1\x80\xd2\x83\xd0\xb8 \xd0\xb8 \xd0\xbf\xd1\x80\xd0\xb8 \xd0\x9f\xd1\x94\xd1\x82\xd1\x80\xd1\xa3 \xd1\x86\xd1\x80\xd2\x83\xd0\xb8 \xd0\xbe\xd1\x81(\xd0\xbc)\xd0\xb8\xd1\xab \xd0\xb6\xd1\x94 \xd0\xb4\xd1\x94\xd1\x81\xd1\xa7\xd1\x82\xd1\x8c \xd0\xbb\xd1\xa3\xd1\x82\xd1\x8a \xd1\x81\xd1\x8a\xc9\xaa \xd0\xbe\xd1\x81\xd1\x82\xd0\xb0\xd0\xb2\xd0\xb8\xd0\xb2\xd1\x8a \xd1\x87\xd1\x80\xd1\x8c\xd0\xb3\xd0\xbe\xd1\xb5\xd0\xb1\xd1\x8a\xc9\xaa\xd0\xbb\xd1\x8c\xd1\x81\xd1\x82\xd0\xb2\xd0\xbe \xd1\x97 \xd0\xb2\xd1\x8c\xd1\x81\xd0\xb5 \xd1\x97\xd0\xbc\xd1\xa3\xd0\xbd\xd0\xb8\xd1\xa5 \xd0\xb1\xd1\x8a\xc9\xaa\xd1\x81\xd1\x82\xd1\x8a \xd1\x87\xd1\x80\xd1\x8c\xd0\xbd\xd0\xbe\xd1\x80\xd0\xb8\xd0\xb7\xd1\x8c\xd1\x86\xd1\x8c \xd1\x97 \xd0\xb2\xd1\x8a \xd1\x82\xd0\xbe\xd0\xbc\xd1\x8c \xd1\x81\xd1\x8c\xd0\xb2\xd1\x80\xd1\x8c\xd1\x88\xd0\xb8 \xd0\xb6\xd0\xb8\xd0\xb7\xd0\xbd\xd1\x8c \xd1\x81\xd0\xb2\xd0\xbe\xd0\xb8\xd1\xab."
127.0.0.1:6379>
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.redis;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.ReactiveRedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.serializer.RedisSerializationContext;
/**
* @author Mark Paluch
*/
public class Reproducer {
@Test
void tryToReproduce() {
RedisClient redisClient = RedisClient.create("redis://localhost");
StatefulRedisConnection<String, String> connect = redisClient.connect();
connect.sync().set("key",
"Сьдє лєжитъ Мостичь чрьгоѵбъɪля бъɪвъɪи при Сѵмеонѣ цр҃и и при Пєтрѣ цр҃и ос(м)иѫ жє дєсѧть лѣтъ съɪ оставивъ чрьгоѵбъɪльство ї вьсе їмѣниѥ бъɪстъ чрьноризьць ї въ томь сьврьши жизнь своиѫ.");
LettuceConnectionFactory lcf = new LettuceConnectionFactory();
lcf.afterPropertiesSet();
ReactiveRedisTemplate<String, String> template = new ReactiveRedisTemplate<>(lcf,
RedisSerializationContext.string());
DefaultRedisScript<List> retrieveRussianStringsFromCacheScript = new DefaultRedisScript<>(
"return redis.call('MGET', 'key')", List.class);
template.execute(retrieveRussianStringsFromCacheScript).doOnNext(list -> System.out.println(list)).blockLast();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment