-
5 votesanswersviews
在spring boot中启用Redis缓存
我的 spring 启动项目有以下配置 . @SpringBootApplication @EnableTransactionManagement @EnableCaching @EnableScheduling @EnableAsync public class Application { String redisHost = "localhost"; in... -
8 votesanswersviews
Spring Redis - 主条目到期后索引未删除
我正在使用Spring Data Repository保存新条目 . 每个条目我的TTL为10秒 . 当我保存带索引的条目时,这是我在Redis中得到的 127.0.0.1:6379> keys * 1) "job:campaignId:aa" 2) "job:a6d6e491-5d75-4fd0-bd8e-71692f6d18be" 3) "... -
0 votesanswersviews
Spring数据redis通过crud接口获得到期时间
无论如何直接从spring数据redis crud获得redis模型的到期时间? 我试过这个,但我不能得到expirationTime . @RedisHash(value = "products") public class Product { @Id @Indexed private String id; private String de... -
1 votesanswersviews
如何自动装配RedisTemplate <String,Object>
我想在spring boot中使用RedisTemplate . 我可以成功使用StringRedisTemplate,但我不能使用RedisTemplate . 这是代码 . @RunWith(SpringRunner.class) @SpringBootTest public class RedisEntityTests { @Autowired private String... -
0 votesanswersviews
无法在spring-data-redis事务中查询列表
template.setEnableTransactionSupport(true); template.multi(); template.opsForValue().set("mykey", "Hello World"); List<String> dataList = template.opsForList().ra... -
0 votesanswersviews
Spring 天启动redis
我正在使用Redis集成的演示Spring启动应用程序 . 我已经提到了各种网站参考,但最后我更喜欢这样做:http://www.baeldung.com/spring-data-redis-tutorial 我的代码与上面的链接几乎相同 . 唯一的变化是我在RestController类中自动连接了StudentRepository . 现在,当我尝试在那时进行maven-install时,它给... -
1 votesanswersviews
使用多个Jedis集群进行Spring Boot缓存
我有2个jedis缓存: localhost:6379 cache.servermachine.com:6380,password=abcdef 其中一个redis实例在本地托管,另一个在具有密码的安全机器上托管 . 我有一个Spring Boot配置类 . public class RedisCacheConfig { @Bean public static PropertySour... -
1 votesanswersviews
Spring(boot)-redis缓存 - 是否需要创建存储库?
我想问一个关于spring缓存注释和存储库创建的问题 . 我试图使用Spring启动在redis中缓存我的值 . (我有一个值,如果它不在缓存中,我需要缓存它,如果它在缓存中,我需要从那里获取它) 我已经看到了几个在线教程,一些使用缓存注释,另一些使用模拟缓存存储库 . (也许他们不排斥对方,这是我的问题) 以下是我读过的一些教程: Cache annotation tips Cach... -
16 votesanswersviews
RedisCacheManager不更新keyspace_misses
我正在使用用于缓存的spring-boot spring-data-redis 1.8.9.RELEASE RedisCacheManager实现CacheManager . 我想要查看的一个指标是缓存命中/未命中率 . 为此,我将通过redis服务器提取keyspace_hits and keyspace_misses,也可以通过redis_cli查看 INFO STATS . 问题是Redi... -
1 votesanswersviews
Spring-data-redis:几个小时后神秘地停止工作
我有一个使用spring-data-redis的后端进程 . 与retwis clone类似,它使用StringRedisTemplate . 在我的Digital Ocean液滴运行约3-4小时后,它神秘地停止了持久的新键 . 我的日志表明我的redis持久性代码正在被调用,它在spring-data-redis / jedis层以某种方式停止工作,没有任何错误迹象 . Troubleshoot... -
0 votesanswersviews
有关Spring Redis模板或Redis的错误?
这个问题几乎让我抓狂!我使用Spring Redis模板作为Redis客户端门户来管理Redis中的缓存项 . 最近我尝试在其中存储一些重要数据(过期时间大约是60秒),但有时(偶尔)它会在几秒钟之后被删除而没有任何迹象!我一次又一次检查我的代码,没有其他删除条目 . 我做了很多实验,发现只有一堆原因:1 . 当我的网络应用程序启动时,大约前五分钟,这种现象经常发生(概率大约是1/3),但在那之后... -
1 votesanswersviews
使用Spring Data Redis保存二进制数据
我'm using Spring Data Redis' Redis Repository feature . 我想将二进制数据保存到Redis . 我创建了一个类似下面的类 . @RedisHash public class AuthorizationCode { @Id private String code; private byte[] authenticatio... -
3 votesanswersviews
使用spring-data-redis更新redis中的实体
我目前正在使用带有Spring数据redis(1.8.9)和Jedis连接器的Redis(3.2.100) . 当我在现有实体上使用save()函数时,Redis删除我的实体并重新创建实体 . 在我的情况下,我需要保留这个现有的实体,只更新实体的属性 . (我有另一个线程同时读取同一个实体) 在Spring文档(https://docs.spring.io/spring-data/data-re... -
0 votesanswersviews
Redis - 过期索引不会被删除
我发现了以下关于Redis中索引到期问题的问题(Spring Redis - Indexes not deleted after main entry expires) . 问题是main和 :phantom 条目到期并正在被正确删除,但相应的 :idx 条目在Redis中孤立存在 . 建议的解决方案之一是启用KeyspaceEvents,以便Redis在清理作业期间自动删除过期条目的索引 . 不... -
2 votesanswersviews
使用存储库的Spring Data Redis批量保存速度太慢,如何管道存储库保存
我们使用Spring Data Redis存储库(repository.save(List))在Redis中保存了250k个对象 . 它太慢了 . 大约需要30分钟 . 我正在使用带有管道的redisTemplate来保存具有相同redis数据结构的250k对象作为存储库(比如使用hmset存储对象,可以存储密钥 . 以便我们可以使用存储库检索对象)保存,设法在150秒内节省250k . 我们如何... -
0 votesanswersviews
如何使缓存数据(在redis上)基于上次访问到期?
我有使用redis-server进行缓存存储的spring微服务应用程序 . 使用RedisCacheManager Api . 在这里我们可以选择设置“ setDefaultExpiration ” . 因为rediscachemanager计算从第一次访问带注释的方法( @cacheable )到期 . 我想计算从可缓存方法的上次访问到第一次访问的到期时间 . Google库已经给出了直接的... -
0 votesanswersviews
Spring Redis问题:来自redis缓存的GetAllCacheNames不能与RedisCacheManager一起使用
嗨,下面是我的redis缓存配置,我正在尝试使用以下命令将所有cachename存储在redis服务器上: redisCacheManager.getCacheNames() 但它没有给我redis服务器中的cacheName . 我使用Cachable注释为cacheName添加前缀:@Cacheable(“cacheName”) 我有2个问题吗? 1)为什么我无法获取存储在redis服务器中的... -
5 votesanswersviews
Spring Cloud,Spring Data Redis和Eureka的 生产环境 考虑因素
我有一个Spring Cloud微服务应用程序,涵盖4种服务器类型:安全网关,两个UI服务器和一个REST API服务器 . 其中每个都将在 生产环境 环境中的自己的VM上运行:REST服务器的4个服务器实例和每个其他服务器的2个实例 . 该系统预计将为大约30,000名用户提供服务 . 服务发现由Eureka提供 . 我有两台Eureka服务器用于故障转移 . 共享HTTP会话由Spring S... -
0 votesanswersviews
检索使用spring redis存储库存储的POJO的TTL
我正在为我的项目使用Spring redis存储库来将POJO保存到redis中 . 以下示例详细介绍了我要实现的目标 . @Data @RedisHash("Example") public class Example { @Id private String id; private String attributeA; private Str... -
2 votesanswersviews
如何使用Spring Data Redis和本地Redis服务器找到性能瓶颈
我正在尝试优化从Redis获取数据的性能 . 服务器当前在我的2015 Macbook Pro上本地运行 . First: Problem explanation 目前我只有32个密钥存储为哈希 . 其中16个在每个哈希值中存储了相当长的JSON字符串,每个哈希值中包含<300个字段 . 剩下的很小,所以我对它们没有任何问题 . 在Spring Boot应用程序中,使用Spring Data... -
7 votesanswersviews
Redis / Spring Data Redis的性能问题
我在Spring Boot应用程序中遇到性能问题,当它与Redis通信时,我希望有专门知识的人能够对此有所了解 . Explanation of what I'm trying to do 简而言之,我的应用程序有2个嵌套映射和3个列表映射,我想保存到Redis并在需要数据时加载回应用程序 . 第一个嵌套映射中的数据相当大,具有几个级别的非原始数据类型(以及这些类型的列表) . 目前,我使用存储库... -
2 votesanswersviews
spring boot data redis repository @Id annotation vs jpa repository @Id
我使用 spring boot 1.5.2 , spring 启动数据redis 1.8 . 我有两个@Id注释,一个用于JPA,另一个用于redis哈希 . 这里我想使用由mysql主键AUTO_INCREMENT生成的JPA @Id值 . 但我发现每次当我使用redis @Id annotaion时,在redis中我的id将是另一个随机值,但我想使用mysql主键 . 我的实体是这样的: @E... -
0 votesanswersviews
如何使用Redis Sentinel使用Docker进行Spring启动
我正在尝试使用docker与Redis Sentinel 3.2.11 Build Spring启动应用程序 . 但是我得到了 引起:io.netty.channel.ConnectTimeoutException:连接超时:/172.27.0.2:6379 我的docker组成配置 version: '3.1' services: master: image: redis:3 ... -
0 votesanswersviews
在Spring Data Redis中启用缓存
我试图实现Spring数据redis并尝试启用缓存 . 但我认为我做错了什么 . 我甚至试过阅读文档和跟随但仍然无法做到这一点 . 我是 Spring 天数据redis的新手 . 我使用1.5.1-RELEASE与jedis 2.6.2 . 这是我添加单词的功能: public Long addWordWithItsMeaningToDictionary (String word, ... -
1 votesanswersviews
Spring Data Redis - 支持命令PUBSUB CHANNELS
RedisTemplate不支持 PUBSUB CHANNELS 命令 . 所以一种方法是做以下事情 private JedisPool getJedisPool(){ if (jedisPool == null) jedisPool = new JedisPool(redisConnectionFactory.getPoolConfig(), redisConne... -
1 votesanswersviews
Spring Data Redis - 对Repository的@Transactional支持
我们将 spring-boot-starter-parent 1.4.1与 spring-boot-starter-redis 和 spring-boot-starter-data-redis 一起使用 . 我们使用redis(a)传递给外部应用程序的消息和(b)将一些信息存储在存储库中 . 我们的redis配置看起来像这样 @Configuration @EnableRedisReposito... -
0 votesanswersviews
Spring Data Redis预测
我有一个实体: @RedisHash("person") @Data class Person{ @Id String id; @Indexed String firstName; @Indexed String lastName; @Indexed int age; } 和Spring Data Repository: public interface Per... -
0 votesanswersviews
在群集模式下,spring数据redis是否支持事务(multi,exec)?
我已经成功地在单个REDIS实例中使用multi和exec功能在redis中实现(并测试)了事务操作 . 但是,在群集设置中运行的相同代码错误地显示以下异常消息 . 我使用的是spring-data-redis-1.8.1.RELEASE和jedis-2.9.0 . 线程“main”org.springframework.dao.InvalidDataAccessApiUsageException... -
1 votesanswersviews
使用spring-data-redis时,与Redis的TLS / SSL连接
使用spring-data-redis和Jedis Build 与Redis sentinel的TLS / SSL连接的推荐方法是什么? 我正在使用spring-data-redis 1.8.3.RELEASE和Jedis 2.9.0 . 我知道Redis不提供对TLS / SSL的直接支持,而是推荐像spiped或stunnel这样的安全代理 . 所以我们假设我已经设置了适当的安全隧道 . 我可... -
0 votesanswersviews
Spring Data Redis:Deserializiation
我有一类不同的数据类型 . 其中一个是 Integer 的 Integer 键和int数组值(它有24个单元格) . 我使用Spring Data将类存储在Redis中,但是当我从Redis获取它时,它会出现以下错误 . 这是 Map : Map<Integer, int[]> mymap = new Hashmap<>(); 这是错误: org.springframew...