Class CacheConfig
java.lang.Object
springboot.bg.harisauto.common.config.cache.CacheConfig
CacheConfig.java - In-process caching for the service catalogue.
The catalogue is read on almost every page and changes only when an administrator edits it, so it is the one thing here worth caching. Writes evict explicitly, so a change made on the admin page is visible immediately; the time limit is only a backstop against a stale entry outliving a restart of a sibling instance.
- Author:
- Kristian Popov
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.cache.CacheManagerBuilds the cache manager.
-
Field Details
-
SERVICES
Cache holding the full service catalogue.- See Also:
-
SERVICE_CATEGORIES
Cache holding the service categories.- See Also:
-
-
Constructor Details
-
CacheConfig
public CacheConfig()
-
-
Method Details
-
cacheManager
@Bean public org.springframework.cache.CacheManager cacheManager()Builds the cache manager.Caffeine keeps this in-process. That suits a single instance; running more than one would need a shared cache, which is why the eviction below is explicit rather than relying on expiry alone.
- Returns:
- The configured cache manager.
-