草庐IT

spring-cloud-starter-lo

全部标签

spring - 使用 Spring + Jedis 设置时,排序集如何存储在 redis 中?

我有一个带有spring-data-redis(1.8.7)和jedis(2.9.0)的Spring4.3.9应用程序。我可以使用如下代码轻松设置和检索ZSET://Commentedout--butbelowlineworksfinetoo//redisTemplate.opsForZSet().remove("score",userId);DoublescoreInRedis=redisTemplate.opsForZSet().score("score",userId);redisTemplate.opsForZSet().add("score",userId,(double)s

java - Redis:在关闭其中一个 Redis 主节点时,Spring Boot 应用程序请求一直失败

这几天被一个redisissue挡住了,感谢大家提早提建议。以下是一些详细信息:Evn:Springboot2.0.3.RELEASE,Redis3.0.6cluster(3master,3slave),Starter:spring-boot-starter-data-redis(defaulversionwithspringboot),whichmeanstheapplicationwilluselettureastheredisclient错误场景:启动应用程序并发送一些请求,一切正常停在master节点上,对应的slave会在20s左右failover成master,也正常。在上

spring - Redis - 为什么使用 Spring Data Redis 将细节保存为 HASH 和 SET?

我是Redis的新手,正在开发SpringBoot+SpringDataRedis示例。我正在使用CrudRepository、Example和ExampleMatchersAPI从Redis键值存储数据库中进行搜索。现在,当我简单地运行我的代码时,我看到人员数据也保存为SET和HASH。这是正确的吗?将人员详细信息同时保存为SET和HASH有什么用显示我所有的代码publicenumGender{MALE,FEMALE{@OverridepublicStringtoString(){return"Superwoman";}}}物种.java@Builder@Data@AllArgsC

java - Redis - 考虑重命名其中一个 bean 或通过设置 spring.main.allow-bean-definition-overriding=true 启用覆盖

我正在开发SpringBoot+SpringDataRedis示例。在此示例中,我正在为RedisMessageListenerContainer开发代码并在此处定义相应的bean。现在,当我运行该应用程序时,出现以下错误。有人可以指导我是什么问题吗?***************************APPLICATIONFAILEDTOSTART***************************Description:Thebean'redisMessageListenerContainer',definedinclasspathresource[org/springfram

java - 无法弄清楚如何使用 Spring 2.0+ 在 Jedis 中设置 SSL 连接

我正在尝试设置一个Spring2.1.2应用程序以将Jedis与SSL结合使用,但找不到任何不适用于Spring2.x+的文档。我的代码是:@Value("${spring.data.redis.host}")privateStringredisHost;@Value("${spring.data.redis.port}")privateIntegerredisPort;@Value("#{environment.REDIS_PASSWORD}")privateStringredisPassword;@BeanJedisConnectionFactoryjedisConnectionF

redis - 使用 Spring Data Repository 在 Redis 中使用 Long 自动增量?

我浏览了链接:SpringData+RediswithAutoincrementKey,但我在Redis中使用PK作为Long。我们如何在Redis中对ids进行自动增量?组.java@RedisHash("groups")publicclassGroup{@IdprivateLonggroupId;privateStringname;}用户.java@RedisHash("users")publicclassUser{@IdprivateLonguserId;privateStringname;privateLocalDatecreatedDate;}此处推荐的方法是什么?有任何快速

java - Spring Cache 中的@Cacheable 在缓存外的redis 中存储值。我如何将它放入redis的缓存中?

@Override@Cacheable("stu")publicEmployeeEntitygetEmployee(Integerid){returnemployeeDAO.findById(id).get();}以上代码将key以“stu::7”格式保存在redis中这里“stu”是缓存的名称,7是键,但它将缓存名称和id作为一个键存储。但我想以这种格式存储在redisSTU->7Stu应该是缓存的名称,里面是所有的键值对。 最佳答案 您可以将自定义key生成器设置为@Cacheable注释,您可以根据需要对其进行自定义:http

java - Spring Jedis 获取键列表返回空

我正在尝试从Redis获取key列表,但它不起作用。@Autowiredorg.springframework.data.redis.core.RedisTemplateredisTemplate;redisTemplate.opsForValue().set("test","test");redisTemplate.opsForValue().set("t:test","test");redisTemplate.opsForValue().set("t::test1","test");redisTemplate.opsForValue().set("t1.t2::test2","te

redis - Google Cloud Memory Store(Redis),实例刚启动时无法连接到redis

当我的实例刚刚启动时,我无法连接到redis。我使用:runtime:javaenv:flexruntime_config:jdk:openjdk8我遇到以下异常:Causedby:redis.clients.jedis.exceptions.JedisConnectionException:java.net.SocketTimeoutException:connecttimedoutRedisConnectionFailureException:CannotgetJedisconnection;nestedexceptionisredis.clients.jedis.exceptio

spring-boot - 使用 spring boot 连接被拒绝的 redis master slave

我在端口3824(主)和3825(从)上设置了一个主从。但是,当我关闭master时,读取操作给出了连接被拒绝的异常。下面是我的配置。我怎么能保证即使我杀了master,我仍然在从slave读取。我哪里错了。@BeanpublicRedisConnectionFactoryredisFactory(){LettuceClientConfigurationconfig=LettuceClientConfiguration.builder().readFrom(ReadFrom.SLAVE_PREFERRED).buld();RedisStandaloneConfigurationserv