CtrlK
BlogDocsLog inGet started
Tessl Logo

giuseppe-trisciuoglio/developer-kit

Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.

82

Quality

82%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Validation failed for skills in this tile
One or more skills have errors that need to be fixed before they can move to Implementation and Discovery review.
Overview
Quality
Evals
Security
Files

spring-framework-cache-docs.mdplugins/developer-kit-java/skills/spring-boot-cache/references/

Spring Framework Cache Reference (Official)

Curated excerpts from the official Spring Framework reference documentation covering caching fundamentals and annotation usage. Source pages are from the Spring Framework Reference Guide 6.2.

Cache Abstraction Overview

  • Purpose: Transparently wrap expensive service methods and reuse results resolved from configured cache managers.

  • Enablement:

    @Configuration
    @EnableCaching
    public class CacheConfig {
        @Bean
        public CacheManager cacheManager() {
            return new ConcurrentMapCacheManager("books");
        }
    }

    Source: /integration/cache/annotations

  • Supported return types: CompletableFuture, Reactor Mono/Flux, blocking objects, and collections are all cacheable. For async/reactive types, Spring stores the resolved value and rehydrates it on retrieval.

Core Annotations

@Cacheable

  • Cache the method invocation result using the provided cache name and key.
  • Supports conditional caching with condition (pre-invocation) and unless (post-invocation, access #result).
@Cacheable(cacheNames = "book", condition = "#isbn.length() == 13", unless = "#result.hardback")
public Book findBook(String isbn) { ... }

Source: /integration/cache/annotations

@CachePut and @CacheEvict

  • @CachePut: Always run the method and update cache entry with fresh result.
  • @CacheEvict: Remove entries; use allEntries = true or beforeInvocation for pre-call eviction.
@CacheEvict(cacheNames = "books", key = "#isbn", beforeInvocation = true)
public void reset(String isbn) { ... }

Source: /integration/cache/annotations

@Caching

  • Bundle multiple cache operations on a single method:
@Caching(evict = {
    @CacheEvict("primary"),
    @CacheEvict(cacheNames = "secondary", key = "#isbn")
})
public Book importBooks(String isbn) { ... }

Source: /integration/cache/annotations

Store Configuration Highlights

  • Caffeine: Configure CaffeineCacheManager to create caches on demand.

    @Bean
    CacheManager cacheManager() {
        return new CaffeineCacheManager();
    }

    Source: /integration/cache/store-configuration

  • XML alternative: Use <cache:annotation-driven cache-manager="..."/> when annotation configuration is not feasible.

    <cache:annotation-driven cache-manager="cacheManager"/>
    <bean id="cacheManager" class="org.springframework.cache.caffeine.CaffeineCacheManager"/>

    Source: /integration/cache/declarative-xml

Reactive and Async Support

  • @Cacheable works with asynchronous signatures:

    @Cacheable("books")
    public Mono<Book> findBook(ISBN isbn) { ... }
    @Cacheable(cacheNames = "foos", sync = true)
    public CompletableFuture<Foo> executeExpensiveOperation(String id) { ... }

    Source: /integration/cache/annotations

Additional Resources

  • spring-cache-doc-snippet.md: Excerpt of the narrative caching overview from the Spring documentation.
  • Refer to cache-core-reference.md for expanded API reference material and cache-examples.md for progressive examples.

plugins

developer-kit-java

skills

README.md

tile.json