Skip to content

ph cache

Philip Helger edited this page Jun 6, 2026 · 3 revisions

Generic caching infrastructure and a precompiled regular expression cache.

Highlights:

  • ICache<K,V> / IMutableCache<K,V> - cache interfaces
  • Cache / MappedCache - simple cache implementations, optionally with a Duration-based time-to-live (since 12.3.0)
  • CacheEntry<V> - internal value+expiration holder used by MappedCache (since 12.3.0)
  • CacheBuilder / ProviderCacheBuilder / ManualCacheBuilder - dedicated builders sharing the common base CacheBuilderBase with expireAfterWrite(Duration) and evictionInterval(Duration) to configure time-based expiration and opt-in background eviction (since 12.3.0)
  • IMutableCacheWithExpiration.putInCache(K, V, Duration) / putInCache(K, V, LocalDateTime) - per-entry expiration overrides for the cache-wide TTL (since 12.3.0)
  • CacheEvictionScheduler - process-wide singleton driving periodic evictExpired() calls for registered caches on one shared daemon thread (since 12.3.0)
  • AnnotationUsageCache - cache for annotation presence checks
  • RegExCache / RegExPattern / RegExHelper - compiled regex pattern caching and utilities

Maven usage

Add the following to your pom.xml to use this artifact:

<dependency>
  <groupId>com.helger.commons</groupId>
  <artifactId>ph-cache</artifactId>
  <version>x.y.z</version>
</dependency>

Clone this wiki locally