dev add cache for search
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-21 16:06:47 +07:00
parent ab796932e6
commit cf2aefe6c3
5 changed files with 50 additions and 15 deletions
@@ -0,0 +1,30 @@
package ru.soune.nocopy.configuration;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
@Configuration
@EnableCaching
public class CacheConfig {
@Bean
public CacheManager cacheManager() {
CaffeineCacheManager cacheManager = new CaffeineCacheManager(
"imageSearch", "parsedImages");
cacheManager.setCaffeine(Caffeine.newBuilder()
.maximumSize(10000)
.expireAfterWrite(1, TimeUnit.HOURS)
.recordStats()
);
return cacheManager;
}
}