/** * {@inheritDoc} */ @Override public long getMaxEntriesInCache() { return cache.getCacheConfiguration().getMaxEntriesInCache(); }
private static void validateConfig(Ehcache ehcache) { CacheConfiguration cacheConfiguration = ehcache.getCacheConfiguration(); final TerracottaConfiguration terracottaConfiguration = cacheConfiguration.getTerracottaConfiguration(); List<ConfigError> errors = new ArrayList<ConfigError>(); if (terracottaConfiguration == null || !terracottaConfiguration.isClustered()) { throw new InvalidConfigurationException( "Cannot create clustered store for non-terracotta clustered caches"); } MemoryStoreEvictionPolicy policy = cacheConfiguration.getMemoryStoreEvictionPolicy(); if (policy == MemoryStoreEvictionPolicy.FIFO || policy == MemoryStoreEvictionPolicy.LFU) { errors.add(new ConfigError("Policy '" + policy + "' is not a supported memory store eviction policy.")); } if (cacheConfiguration.isOverflowToDisk()) { if (LOG.isWarnEnabled()) { LOG.warn("Persistence on disk on the local node is not supported with a Terracotta clustered ehcache store. Configure the Terracotta server array to be persistent instead."); } } boolean cachePinned = cacheConfiguration.getPinningConfiguration() != null && cacheConfiguration.getPinningConfiguration().getStore() == PinningConfiguration.Store.INCACHE; if (cachePinned && cacheConfiguration.getMaxEntriesInCache() != CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE) { errors.add(new ConfigError("Cache pinning is not supported with maxEntriesInCache")); } if (errors.size() > 0) { throw new InvalidConfigurationException(errors); } }
if (ehcacheConfig.getMaxEntriesInCache() != CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE) { if (ehcacheConfig.getMaxEntriesInCache() > Integer.MAX_VALUE) { throw new IllegalArgumentException("Values greater than Integer.MAX_VALUE are not currently supported."); } else { builder.maxTotalCount((int) ehcacheConfig.getMaxEntriesInCache());
/** * {@inheritDoc} */ @Override public long getMaxEntriesInCache() { return cache.getCacheConfiguration().getMaxEntriesInCache(); }
/** * {@inheritDoc} */ @Override public long getMaxEntriesInCache() { return cache.getCacheConfiguration().getMaxEntriesInCache(); }
@Autowired @Bean public TicketRegistry ticketRegistry(@Qualifier("ehcacheTicketCacheManager") final CacheManager manager, @Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) { val crypto = casProperties.getTicket().getRegistry().getEhcache().getCrypto(); val definitions = ticketCatalog.findAll(); definitions.forEach(t -> { val ehcache = buildCache(t); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Created Ehcache cache [{}] for [{}]", ehcache.getName(), t); val config = ehcache.getCacheConfiguration(); LOGGER.debug("TicketCache.maxEntriesLocalHeap=[{}]", config.getMaxEntriesLocalHeap()); LOGGER.debug("TicketCache.maxEntriesLocalDisk=[{}]", config.getMaxEntriesLocalDisk()); LOGGER.debug("TicketCache.maxEntriesInCache=[{}]", config.getMaxEntriesInCache()); LOGGER.debug("TicketCache.persistenceConfiguration=[{}]", config.getPersistenceConfiguration().getStrategy()); LOGGER.debug("TicketCache.synchronousWrites=[{}]", config.getPersistenceConfiguration().getSynchronousWrites()); LOGGER.debug("TicketCache.timeToLive=[{}]", config.getTimeToLiveSeconds()); LOGGER.debug("TicketCache.timeToIdle=[{}]", config.getTimeToIdleSeconds()); LOGGER.debug("TicketCache.cacheManager=[{}]", ehcache.getCacheManager().getName()); } manager.addDecoratedCacheIfAbsent(ehcache); }); if (LOGGER.isDebugEnabled()) { LOGGER.debug("The following caches are available: [{}]", (Object[]) manager.getCacheNames()); } return new EhCacheTicketRegistry(ticketCatalog, manager, CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "ehcache")); }
.defaultValue(CacheConfiguration.DEFAULT_TTL)); if (cacheConfiguration.isTerracottaClustered()) { element.addAttribute(new SimpleNodeAttribute("maxEntriesInCache", cacheConfiguration.getMaxEntriesInCache()).optional(true) .defaultValue(CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE));
.defaultValue(CacheConfiguration.DEFAULT_TTL)); if (cacheConfiguration.isTerracottaClustered()) { element.addAttribute(new SimpleNodeAttribute("maxEntriesInCache", cacheConfiguration.getMaxEntriesInCache()).optional(true) .defaultValue(CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE));
.defaultValue(CacheConfiguration.DEFAULT_TTL)); if (cacheConfiguration.isTerracottaClustered()) { element.addAttribute(new SimpleNodeAttribute("maxEntriesInCache", cacheConfiguration.getMaxEntriesInCache()).optional(true) .defaultValue(CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE));