spring-boot-cache

Implements Spring Boot 3.5+ caching with annotations and multiple providers including Caffeine and Redis.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill spring-boot-cache-rizaldiem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-boot-cache
Source: https://github.com/rizaldiem/digital-invitation-web_V2/tree/main/.windsurf/skills/spring-boot-cache
Command: npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill spring-boot-cache-rizaldiem

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Reduce repeated expensive service method executions by transparently caching results, improving latency and throughput for read-heavy application paths.

Core Features & Use Cases

  • Annotation-driven caching: Use @Cacheable, @CachePut, and @CacheEvict to declaratively control caching at the service-method level.
  • Multiple providers and strategies: Configure Caffeine, Redis, Ehcache, JCache, or the simple in-memory provider with TTLs, capacity limits, and multi-level approaches.
  • Operational tooling and testing: Expose cache metrics via Actuator and Micrometer, schedule evictions or warm caches at startup, and validate behavior with unit and integration tests.
  • Real-world example: Cache user and product lookups with a CaffeineCacheManager for low-latency hits and use Redis for distributed caches across instances.

Quick Start

Add the spring-boot-starter-cache dependency, enable caching and a CacheManager bean, then annotate your service methods with @Cacheable/@CachePut/@CacheEvict to begin caching.

Frequently Asked Questions about spring-boot-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add caching to Spring Boot service methods to reduce latency?

Add Spring Boot caching by enabling caching, configuring a CacheManager bean, and annotating service methods with @Cacheable, @CachePut, or @CacheEvict to transparently cache results and reduce repeated expensive method executions.

Can I use Redis for distributed caching across multiple Spring Boot instances?

Yes, Redis supports distributed caching across multiple Spring Boot instances. Configure Redis as your CacheManager provider to share cached data across instances, while CaffeineCacheManager provides low-latency local in-memory caching for single-instance deployments.

What's the best way to configure cache eviction and TTL in Spring Boot?

Configure cache eviction and TTL by setting capacity limits and expiration policies on your CacheManager provider. Use @CacheEvict annotations for declarative eviction, schedule evictions programmatically, or configure TTL settings on Caffeine, Redis, Ehcache, or JCache providers.

Does Spring Boot caching work with Actuator and Micrometer for cache metrics?

Yes, Spring Boot caching integrates with Actuator and Micrometer to expose cache metrics for observability. Monitor cache hits, misses, and eviction statistics through Actuator endpoints to evaluate cache effectiveness and tune performance.

How do I warm caches at startup in a Spring Boot application?

Warm caches at startup by scheduling cache initialization logic that pre-populates cache entries before serving requests. Combine this with configurable CacheManager beans and eviction strategies to maintain optimal cache state throughout application lifecycle.

When should I not use annotation-driven caching in Spring Boot?

Avoid annotation-driven caching when methods have highly volatile data requiring strong consistency, when cache key semantics become too complex for declarative annotations, or when transactional interactions between @Cacheable and database operations create stale data risks.