New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Step-by-step Spring Boot caching guide that configures providers, annotations, TTL, and Actuator metrics.

skills.sh installs
4K
GitHub stars
372
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers the caching workflow: dependencies, @EnableCaching, @Cacheable/@CachePut/@CacheEvict annotations, TTL configuration, and validation
  • Includes Caffeine, Redis, and Ehcache provider setup, plus SpEL key shaping with condition and unless guards
  • Enforces a self-invocation check, since calls within the same class bypass the proxy and the cache
  • Designed for Spring Boot 3.5+ services that need hit/miss diagnosis through GET /actuator/caches and cache.gets metrics

Install

$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-cache -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Spring Boot Cache Abstraction

Overview

6-step workflow for enabling cache abstraction, configuring providers (Caffeine, Redis, Ehcache), annotating service methods, and validating behavior in Spring Boot 3.5+ applications. Apply @Cacheable for reads, @CachePut for writes, @CacheEvict for deletions. Configure TTL/eviction policies and expose metrics via Actuator.

When to Use

  • Add @Cacheable, @CachePut, or @CacheEvict to service methods.
  • Configure Caffeine, Redis, or Ehcache with TTL and capacity policies.
  • Implement eviction strategies for stale data.
  • Diagnose cache misses or invalidation issues.
  • Expose hit/miss metrics via Actuator or Micrometer.

Instructions

  1. Add dependencies — spring-boot-starter-cache plus a provider:

    • Caffeine: caffeine starter
    • Redis: spring-boot-starter-data-redis
    • Ehcache: ehcache starter
  2. Enable caching — annotate a @Configuration class with @EnableCaching and define a CacheManager bean.

  3. Annotate methods — @Cacheable for reads, @CachePut for writes, @CacheEvict for deletions.

Details

Repository
github.com/giuseppe-trisciuoglio/developer-kit
Categories
Java & JVM, Backend & APIs
First seen
May 16, 2026

More from giuseppe-trisciuoglio/developer-kit

All 95

Similar to Spring Boot Cache

More Java & JVM