alibaba / jetcache

JetCache is a Java cache framework.
Apache License 2.0
5.09k stars 1.05k forks source link

使用api创建redis redis.springdata缓存不起作用 #828

Open EvianTian opened 1 year ago

EvianTian commented 1 year ago

如题,使用@Cached注解创建redis redis.springdata缓存正常,使用api创建的不起作用,掉put存入缓存后,实际redis中无数据,无任何报错信息。

springboot 版本2.4.3 redsi版本 3.2.1 jetcache版本 2.6.7 2.7.4都试过还是不行

jetcache 2.6.7 redis缓存 GenericObjectPoolConfig pc = new GenericObjectPoolConfig(); pc.setMinIdle(2); pc.setMaxIdle(10); pc.setMaxTotal(10); JedisPool jedisPool = new JedisPool(pc, "localhost", 6379,15,"123456",15);

    String keyPrefix = "projectA:default_" + "demo:";
    this.cache = RedisCacheBuilder.createRedisCacheBuilder()
           .jedisPool(jedisPool)
           .keyPrefix(keyPrefix)
           .expireAfterWrite(60, TimeUnit.SECONDS)
           .buildCache();

redis.springdata缓存

this.cache = RedisSpringDataCacheBuilder.createBuilder() .keyPrefix(keyPrefix) .connectionFactory(redisConnectionFactory) .buildCache();

jetcache 2.7.4 redis缓存 和 redis.springdata缓存 QuickConfig qc = QuickConfig.newBuilder(CACHE_NAME) .expire(Duration.ofSeconds(100000)) .cacheType(CacheType.REMOTE) .penetrationProtect(true) .useAreaInPrefix(true) .syncLocal(true) .build(); this.cache = cacheManager.getOrCreateCache(qc);

使用RedisSpringDataCacheBuilder RedisCacheBuilder 都不行