
Spring Boot Cache
Add declarative caching to Spring Boot services using @Cacheable, CacheManager, and Redis or Caffeine without guessing annotation parameters.
Overview
Spring Boot Cache is an agent skill for the Build phase that documents Spring Cache abstraction APIs, managers, and annotations for caching service method results.
Install
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-boot-cacheWhat is this skill?
- Documents CacheManager implementations: ConcurrentMap, Caffeine, EhCache, Redis
- Annotation matrix for @Cacheable, @CachePut with value, key, condition, unless
- Cache interface operations: get, put, evict, clear, native cache access
- Targets production Spring Boot backends choosing in-memory vs distributed stores
Adoption & trust: 1.2k installs on skills.sh; 271 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are adding caching to Spring Boot but need a concise map of CacheManager types, Cache methods, and annotation parameters before wiring Redis or Caffeine.
Who is it for?
Solo builders implementing Spring Boot REST or service layers who want annotation-level caching guidance during backend work.
Skip if: Teams needing full Redis cluster ops, cache warming runbooks, or non-JVM stacks without Spring.
When should I use this skill?
Implementing or reviewing Spring Boot service-layer caching, CacheManager setup, or cache annotation parameters.
What do I get? / Deliverables
Your agent applies correct @Cacheable keys and manager choices aligned with Spring's Cache and CacheManager contracts.
- Annotated service methods
- CacheManager configuration notes
- Provider choice rationale
Recommended Skills
Journey fit
How it compares
Reference skill for Spring's cache layer, not a standalone code generator or MCP database connector.
Common Questions / FAQ
Who is spring-boot-cache for?
Indie and solo developers building Spring Boot APIs who want declarative caching patterns while the backend is still taking shape.
When should I use spring-boot-cache?
During Build → backend when choosing cache managers, annotating service methods, or comparing in-memory vs Redis-backed caching.
Is spring-boot-cache safe to install?
It is documentation-style guidance with no runtime permissions; review the Security Audits panel on this page before trusting any third-party skill in production repos.
SKILL.md
READMESKILL.md - Spring Boot Cache
# Spring Boot Cache Abstraction - References Complete API reference and external resources for Spring Boot caching. ## Spring Cache Abstraction API Reference ### Core Interfaces #### CacheManager Interface for managing cache instances. ```java public interface CacheManager { // Get a cache by name Cache getCache(String name); // Get all available cache names Collection<String> getCacheNames(); } ``` **Common Implementations:** - `ConcurrentMapCacheManager` - In-memory, thread-safe caching - `SimpleCacheManager` - Simple static cache configuration - `CaffeineCacheManager` - High-performance caching with Caffeine library - `EhCacheManager` - Enterprise caching with EhCache - `RedisCacheManager` - Distributed caching with Redis #### Cache Interface representing a single cache. ```java public interface Cache { // Get cache name String getName(); // Get native cache implementation Object getNativeCache(); // Get value by key ValueWrapper get(Object key); // Put value in cache void put(Object key, Object value); // Remove entry from cache void evict(Object key); // Clear entire cache void clear(); } ``` ### Cache Annotations | Annotation | Purpose | Target | Parameters | |-----------|---------|--------|-----------| | `@Cacheable` | Cache method result before execution | Methods | `value`, `key`, `condition`, `unless` | | `@CachePut` | Always execute, then cache result | Methods | `value`, `key`, `condition`, `unless` | | `@CacheEvict` | Remove entry/entries from cache | Methods | `value`, `key`, `allEntries`, `condition`, `beforeInvocation` | | `@Caching` | Combine multiple cache operations | Methods | `cacheable`, `put`, `evict` | | `@CacheConfig` | Class-level cache configuration | Classes | `cacheNames` | | `@EnableCaching` | Enable caching support | Configuration classes | None | ### Annotation Parameters #### value / cacheNames Name(s) of the cache(s) to use. ```java @Cacheable(value = "products") // Single cache @Cacheable(value = {"products", "inventory"}) // Multiple caches ``` #### key SpEL expression to generate cache key (if not using method parameters as key). ```java @Cacheable(value = "products", key = "#id") @Cacheable(value = "products", key = "#p0") // First parameter @Cacheable(value = "products", key = "#root.methodName + #id") @Cacheable(value = "products", key = "T(java.util.Objects).hash(#id, #name)") ``` **SpEL Context Variables:** - `#root.methodName` - Method name being invoked - `#root.method` - Method object - `#root.target` - Target object - `#root.targetClass` - Target class - `#root.args[0]` - Method arguments array - `#a0`, `#p0` - First argument - `#result` - Method result (only in `@`CachePut, `@`CacheEvict) #### condition SpEL expression evaluated before cache operation. Operation only executes if true. ```java @Cacheable(value = "products", condition = "#id > 0") @Cacheable(value = "products", condition = "#price > 100 && #active == true") @Cacheable(value = "products", condition = "#size() > 0") // For collections ``` #### unless SpEL expression evaluated AFTER method execution. Entry is cached only if false. ```java @Cacheable(value = "products", unless = "#result == null") @CachePut(value = "products", unless = "#result.isPrivate()") ``` #### beforeInvocation For `@`CacheEvict only. If true, cache is evicted BEFORE method execution (default: false). ```java @CacheEvict(value = "products", beforeInvocation = true) // Evict before call @CacheEvict(value = "products", beforeInvocation = false) // Evict after call ``` #### allEntries For `@`CacheEvict only. If true, entire cache is cleared instead of single entry. ```java @CacheEvict(value = "products", allEntries = true) // Clear all entries ``` ## Configuration Reference ### Maven Dependencies ```xml <!-- Spring Cache Starter --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-star