AddressImageCache.ktAddressImageDO metadata (excluding binary image data). Provides fast lookup of whether an address has an image and what its type is.AddressImageCache extends AbstractCache, ProjectForge's base class for refreshable caches. The framework calls refresh() periodically or on-demand, synchronized to prevent concurrent modifications.
The cache stores a Map<Long, AddressImageDO> where each value is a lightweight AddressImageDO containing only:
lastUpdate — Modification timestamp for cache freshness checks.imageType — The image format (ImageType.PNG by default).Binary data is excluded — neither preview nor image byte arrays are loaded. This keeps the cache memory-efficient while still answering "does address X have an image?" queries instantly.
refresh() runs inside a read-only isolated persistence context (for clean transaction boundaries). It uses a JPQL query selecting addressId, lastUpdate, and imageType as a Tuple projection, rebuilding the entire map atomically to avoid concurrent read issues.
getImage(addressId) is the sole public API. It calls checkRefresh() (inherited from AbstractCache) to ensure freshness before looking up the map. A null return means no image exists for that address.
The companion object holds a lateinit var instance set in @PostConstruct, allowing static access from code that cannot use Spring injection.
868d6abb7 2025 -> 2026 63081666f Source file headers: 2024-> 2025. 943947aaa Addresses: support of gif and jpeg 0ceceb28f All cache refreshs are now running in isolated transactions 5989b32fd BaseDao: mechanism of onChangeLister refactored. 1b50060c3 BaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select