Instruction set for enabling and operating the Spring Cache abstraction in Spring Boot when implementing application-level caching for performance-sensitive workloads.
/plugin marketplace add giuseppe-trisciuoglio/developer-kit/plugin install developer-kit@giuseppe.trisciuoglioThis skill is limited to using the following tools:
references/cache-core-reference.mdreferences/cache-examples.mdreferences/spring-cache-doc-snippet.mdreferences/spring-framework-cache-docs.mdSpring Boot ships with a cache abstraction that wraps expensive service calls behind annotation-driven caches. This abstraction supports multiple cache providers (ConcurrentMap, Caffeine, Redis, Ehcache, JCache) without changing business code. The skill provides a concise workflow for enabling caching, managing cache lifecycles, and validating behavior in Spring Boot 3.5+ services.
@Cacheable, @CachePut, or @CacheEvict to Spring Boot service methods.Use trigger phrases such as "implement service caching", "configure CaffeineCacheManager", "evict caches on update", or "test Spring cache behavior" to load this skill.
spring-boot-starter-cache; add provider-specific starters as
needed (spring-boot-starter-data-redis, caffeine, ehcache, etc.).Add dependencies
<!-- Maven -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency> <!-- Optional: Caffeine -->
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
implementation "org.springframework.boot:spring-boot-starter-cache"
implementation "com.github.ben-manes.caffeine:caffeine"
Enable caching
@Configuration
@EnableCaching
class CacheConfig {
@Bean
CacheManager cacheManager() {
return new CaffeineCacheManager("users", "orders");
}
}
Annotate service methods
@Service
@CacheConfig(cacheNames = "users")
class UserService {
@Cacheable(key = "#id", unless = "#result == null")
User findUser(Long id) { ... }
@CachePut(key = "#user.id")
User refreshUser(User user) { ... }
@CacheEvict(key = "#id", beforeInvocation = false)
void deleteUser(Long id) { ... }
}
Verify behavior
cache endpoint (if enabled) for hit/miss counters.@Cacheable.@CachePut on write paths that must refresh cache entries.@CacheEvict (allEntries = true when invalidating derived caches).@Caching to keep multi-cache updates consistent.key = "#user.id").condition = "#price > 0" for selective caching.unless = "#result == null".sync = true when needed.spring.cache.caffeine.spec=maximumSize=500,expireAfterWrite=10mspring.cache.redis.time-to-live=600000ttl and heap/off-heap resources.spring.cache.cache-names=users,orders,catalog.CacheManagementService with
programmatic cacheManager.getCache(name) access.@Scheduled.cache endpoint and Micrometer meters to track hit ratio,
eviction count, and size.sync = true scenarios).@CacheResult, @CacheRemove). Avoid mixing with Spring annotations
on the same method.Mono, Flux) or CompletableFuture values.
Spring stores resolved values and resubscribes on hits; consider TTL alignment
with publisher semantics.CacheControl when exposing cached responses
via REST.references/cache-examples.md for
progressive scenarios (basic product cache, conditional caching, multilevel
eviction, Redis integration).references/cache-core-reference.md
for annotation matrices, configuration tables, and property samples.references/spring-framework-cache-docs.md:
curated excerpts from the Spring Framework Reference Guide (official).references/spring-cache-doc-snippet.md:
narrative overview extracted from Spring documentation.references/cache-core-reference.md:
annotation parameters, dependency matrices, property catalogs.references/cache-examples.md:
end-to-end examples with tests.users, orders) to simplify eviction.This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.