Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis Caching

  1. @EnableCaching To enable the caching api of spring boot.
  2. @Cacheable Read from cache or compute and store.
  3. @CachePut Always execute method, update cache.
  4. @CacheEvict Remove cache entry.
  5. @Caching Combine multiple cache operations together.

Default

  • ConcurrentMapCacheManager: Backed by ConcurrentHashMap.
  • JVM memory only, good for local build.

Im-Memory

  • Caffeine / EhCache, still in process but muc smarter.
spring:
  cache:
    type: caffeine
@Bean
public CaffeineCacheManager cacheManager() {
    CaffeineCacheManager manager = new CaffeineCacheManager("users");
    manager.setCaffeine(
            Caffeine.newBuilder()
                    .expireAfterWrite(10, TimeUnit.MINUTES)
                    .maximumSize(10_000)
    );
    return manager;
}
  • Provides ttl, eviction policies.

Redis (Distributed)

  • Redis is external, shared, and persistent.
  • Microservices, multiple app instances.

Resilience4J

Circuit Breaker

  Prevents cascading failures when a dependency keeps failing.

States:

  1. CLOSED → calls allowed
  2. OPEN → calls blocked, fallback triggered
  3. HALF_OPEN → limited test calls

Retry

  Handles temporary failures (timeouts, network glitches).

Bulkhead

  Stops resource starvation by isolating calls.

Rate Limiter

  Protects services from traffic spikes or abuse.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages