Loading...
Loading...
Instruction set for enabling and operating the Spring Cache abstraction in Spring Boot when implementing application-level caching for performance-sensitive workloads.
npx skill4agent add vuralserhat86/antigravity-agentic-skills cache_patterns@Cacheable@CachePut@CacheEvictspring-boot-starter-cachespring-boot-starter-data-rediscaffeineehcache<!-- 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"@Configuration
@EnableCaching
class CacheConfig {
@Bean
CacheManager cacheManager() {
return new CaffeineCacheManager("users", "orders");
}
}@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) { ... }
}cacheallEntries=truecache@SpringBootTest| Aşama | Doğrulama |
|---|---|
| 1 | Transactional işlemler sırasında cache tutarlılığı (Data drift) bozuluyor mu? |
| 2 | "Cache-aside" veya "ReadOnly" stratejisi doğru uygulandı mı? |
| 3 | Çoklu instance yapısında "Cache Stampede" riski önlendi mi? |
@CacheResult@CacheRemoveMonoFluxCompletableFutureCacheControlreferences/cache-examples.mdreferences/cache-core-reference.mdreferences/spring-framework-cache-docs.mdreferences/spring-cache-doc-snippet.mdreferences/cache-core-reference.mdreferences/cache-examples.mdusersordersskills/spring-boot/spring-boot-rest-api-standardsskills/spring-boot/spring-boot-test-patternsskills/junit-test/unit-test-caching