Redis
 sql >> Teknologi Basis Data >  >> NoSQL >> Redis

atur kunci kedaluwarsa pada waktu tertentu saat menggunakan Spring caching dengan Redis

@Bean (name="cacheManager")
public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
    RedisCacheConfiguration conf_ready_info = RedisCacheConfiguration.defaultCacheConfig()
            .entryTtl(Duration.ofMillis(50000));

    RedisCacheConfiguration conf_base_info = RedisCacheConfiguration.defaultCacheConfig()
            .entryTtl(Duration.ofMillis(60000));

    Map<String, RedisCacheConfiguration> cacheConfigurations = new HashMap<String, RedisCacheConfiguration>();
    cacheConfigurations.put("base_info", conf_base_info);
    cacheConfigurations.put("ready_info", conf_ready_info);

    return RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(connectionFactory)
            .withInitialCacheConfigurations(cacheConfigurations).build();
}


@Cacheable(value = "ready_info", key = "#aid")
public String  findByAid(String aid) throws Exception { 
    String readyInfo = "";
    return readyInfo;
}


  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. Penggunaan sederhana EM::Synchrony#sync menyebabkan FiberError 'root fiber' -- salah saya?

  2. Mengekspos Redis dengan Ingress Nginx Controller

  3. JedisPoolConfig tidak dapat ditetapkan ke GenericObjectPoolConfig

  4. Rel, Sidekiq - Redis NOAUTH

  5. Beberapa kunci yang menunjuk ke nilai tunggal di Redis (Cache) dengan java