Source:
<code>private CacheConfiguration<String, Ticket> buildCacheConfiguration(final TicketDefinition ticketDefinition) { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val terracottaClusterUri = ehcacheProperties.getTerracottaClusterUri(); CacheEventListenerConfigurationBuilder cacheEventListenerConfiguration = CacheEventListenerConfigurationBuilder .newEventListenerConfiguration(new CasCacheEventListener(), EventType.CREATED, EventType.UPDATED, EventType.EXPIRED, EventType.REMOVED, EventType.EVICTED) .ordered().asynchronous(); val storageTimeout = ticketDefinition.getProperties().getStorageTimeout(); val expiryPolicy = ehcacheProperties.isEternal() <START> ? ExpiryPolicyBuilder.noExpiration() : ExpiryPolicyBuilder.expiry() <END> .create(Duration.ofSeconds(storageTimeout)) .access(Duration.ofSeconds(storageTimeout)) .update(Duration.ofSeconds(storageTimeout)).build(); var resourcePools = ResourcePoolsBuilder.heap(ehcacheProperties.getMaxElementsInMemory()); if (StringUtils.isNotBlank(terracottaClusterUri)) { resourcePools = resourcePools.with( ClusteredResourcePoolBuilder.clusteredShared(ehcacheProperties.getResourcePoolName())); } resourcePools = resourcePools .offheap(ehcacheProperties.getResourcePoolSize(), MemoryUnit.valueOf(ehcacheProperties.getResourcePoolUnits())); if (StringUtils.isBlank(terracottaClusterUri)) { resourcePools = resourcePools.disk(ehcacheProperties.getPerCacheSizeOnDisk(), MemoryUnit.valueOf(ehcacheProperties.getPerCacheSizeOnDiskUnits())); } var cacheConfigBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, Ticket.class, resourcePools) .withExpiry(expiryPolicy) .withService(cacheEventListenerConfiguration); if (StringUtils.isNotBlank(terracottaClusterUri)) { cacheConfigBuilder = cacheConfigBuilder.withService( ClusteredStoreConfigurationBuilder.withConsistency(Consistency.STRONG)); } return cacheConfigBuilder.build(); }</code><technical_language>Nitpicking here; easier read this line if merged in line: ? xyz : abc</technical_language>

Target:
private CacheConfiguration<String, Ticket> buildCacheConfiguration(final TicketDefinition ticketDefinition) { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val terracottaClusterUri = ehcacheProperties.getTerracottaClusterUri(); CacheEventListenerConfigurationBuilder cacheEventListenerConfiguration = CacheEventListenerConfigurationBuilder .newEventListenerConfiguration(new CasCacheEventListener(), EventType.CREATED, EventType.UPDATED, EventType.EXPIRED, EventType.REMOVED, EventType.EVICTED) .ordered().asynchronous(); val storageTimeout = ticketDefinition.getProperties().getStorageTimeout(); val expiryPolicy = ehcacheProperties.isEternal() ? ExpiryPolicyBuilder.noExpiration() : ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(storageTimeout)); var resourcePools = ResourcePoolsBuilder.heap(ehcacheProperties.getMaxElementsInMemory()); if (StringUtils.isNotBlank(terracottaClusterUri)) { resourcePools = resourcePools.with( ClusteredResourcePoolBuilder.clusteredShared(ehcacheProperties.getResourcePoolName())); } resourcePools = resourcePools .offheap(ehcacheProperties.getResourcePoolSize(), MemoryUnit.valueOf(ehcacheProperties.getResourcePoolUnits())); if (StringUtils.isBlank(terracottaClusterUri)) { resourcePools = resourcePools.disk(ehcacheProperties.getPerCacheSizeOnDisk(), MemoryUnit.valueOf(ehcacheProperties.getPerCacheSizeOnDiskUnits())); } var cacheConfigBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, Ticket.class, resourcePools) .withExpiry(expiryPolicy) .withService(cacheEventListenerConfiguration); if (StringUtils.isNotBlank(terracottaClusterUri)) { cacheConfigBuilder = cacheConfigBuilder.withService( ClusteredStoreConfigurationBuilder.withConsistency(Consistency.valueOf(ehcacheProperties.getClusteredCacheConsistency().name()))); } return cacheConfigBuilder.build(); }