spring-data-redis

spring-boot-starter-data-redis Cacheable(sync=true) sees not work?

别说谁变了你拦得住时间么 提交于 2020-01-02 12:04:51
问题 i want to use Cacheable(sync=true) to controll concurrent behaviors to access a method @Service @CacheConfig(cacheNames = "book") public class BookService { @Cacheable(key = "#isbn",sync = true) public Book book(String isbn,int id) { System.out.println("wait 3s..."); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } return new Book(isbn, "xxxx"); } } write a test case: ExecutorService executorService = Executors.newFixedThreadPool(10); for (int i = 0; i < 100

Redis - How the key HASH and SET and ZSET are related on the CrudRepository save?

元气小坏坏 提交于 2020-01-01 19:58:35
问题 I am new to Redis and developing code using Spring Boot + Spring Data Redis example. When I saved the records, I see KEYS gets created and out of these keys 4 are HASH , 1 ZSET and all others are SET . I did not see in the Spring docs, meaning of each KEY is getting saved. . 127.0.0.1:6379> KEYS * 1) "persons:c5cfd49d-6688-4b83-a9b7-be55dd1c36ad" 2) "persons:firstname:bran" 3) "persons:39e14dae-fa23-4935-948f-1922d668d1c2" 4) "persons:f0b6dd26-8922-4a36-bd2a-792a17dddff7" 5) "persons:address

Could not connect to Redis at 10.XX.XX.28:6379: Unknown error - while accessing from Spring Batch or windows machine

白昼怎懂夜的黑 提交于 2019-12-30 11:55:28
问题 I have followed all the steps from link: https://linuxtechlab.com/how-install-redis-server-linux/ and using below linux version. uname -a Linux ech-10-XX-XX-28 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 17:03:21 PDT 2017 x86_64 x86_64 x86_64 GNU/Linux This is installed somewhere on cloud on virtual machine and from local windows machine I am trying to access the redis getting below error mentioned here: nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not

Spring boot + redis

允我心安 提交于 2019-12-25 10:38:34
问题 I am working demo Spring boot application with integration of Redis. I have referred various site reference but lastly I preferred to follow this: http://www.baeldung.com/spring-data-redis-tutorial My code is almost same as given in above link. Only change is that I have autowired StudentRepository in my RestController class. Now when I try to do maven-install at that time it gives me error that java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework

Redis - Expired Indexes are not deleted

巧了我就是萌 提交于 2019-12-24 20:17:26
问题 I found the following question (Spring Redis - Indexes not deleted after main entry expires) about a problem with expiration of indexes in Redis. The problem is that the main and :phantom entries expire and are being deleted correctly, but the corresponding :idx entries survive orphaned in Redis. One of the proposed solutions was to enable KeyspaceEvents, so that Redis automatically removes indexes of expired entries during the cleanup job. Unfortunately this solution will not work for our

Configuring Spring Data Redis with Lettuce for Redis master/slave

家住魔仙堡 提交于 2019-12-24 08:03:08
问题 Using Lettuce, how do we configure Spring Data Redis running on host x at port 6379 and slave running on the same or different host but at port 6380? 回答1: That's a feature which will be included in the upcoming Spring Data Redis 2.1 release. You would configure LettuceConnectionFactory similar to: LettuceClientConfiguration configuration = LettuceClientConfiguration.builder() .readFrom(ReadFrom.SLAVE) .build(); LettuceConnectionFactory factory = new LettuceConnectionFactory(new

Create Lettuce StatefulRedisConnection for storing string as keys and byte array as value

ⅰ亾dé卋堺 提交于 2019-12-23 02:30:12
问题 I have a Spring boot application which connects to a Redis cluster on AWS. I was trying out Lettuce, and want to create a StatefulRedisConnection for storing keys as string, but values as byte array. I tried using the built-in ByteArrayCodec , but it takes both the key and value as a byte array. I'm new to Lettuce, so I'm not sure whether I need to write a custom codec. If so, how would I write it? And would there be any performance issues? Or am I going down the wrong path? 回答1: Below code

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type to type [java.lang.String] - Redis

旧城冷巷雨未停 提交于 2019-12-22 16:17:04
问题 I am using Spring Data Redis with the Spring Boot 2.0 example. In this example, I am trying to save the Customer data + Student data together. I'm not very sure how the data modelling happens here, but assuming its same like as Mongo DB (pure non relational). Could someone please help with the below error ? As its clear that some conversion has been expected to see the data. Error: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type to type [java.lang.String] - Redis

耗尽温柔 提交于 2019-12-22 16:13:52
问题 I am using Spring Data Redis with the Spring Boot 2.0 example. In this example, I am trying to save the Customer data + Student data together. I'm not very sure how the data modelling happens here, but assuming its same like as Mongo DB (pure non relational). Could someone please help with the below error ? As its clear that some conversion has been expected to see the data. Error: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type

Whether LettuceConnectionFactory have version restrictions on redis and springboot?

孤人 提交于 2019-12-22 09:58:01
问题 The project need a custom RedisConnectionFactory and finds a problem: when using LettuceConnectionFactory , the runtime always reports java.lang.NullPointerException, while JedisConnectionFactory can pass tests. I think that whether LettuceConnectionFactory have version restrictions on redis and springboot? Developing environment: Springboot: 2.1.0.release redis:3.2.8 jdk8. Java Code @Component @Configuration public class RedisConfig { public LettuceConnectionFactory