001package com.avaje.ebean.annotation; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Retention; 005import java.lang.annotation.RetentionPolicy; 006import java.lang.annotation.Target; 007 008/** 009 * Cache tuning hints for the L2 bean cache of a specific entity type. 010 * <p> 011 * Note that this is not useful when distributed L2 bean caches are used like 012 * ElasticSearch, Hazelcast, Ignite etc. 013 * </p> 014 */ 015@Target({ ElementType.TYPE }) 016@Retention(RetentionPolicy.RUNTIME) 017public @interface CacheBeanTuning { 018 019 /** 020 * The maximum size for the cache. 021 * <p> 022 * This defaults to 0 which means unlimited. 023 * </p> 024 */ 025 int maxSize() default 0; 026 027 /** 028 * The maximum time (in seconds) that a cache entry is allowed to stay in the 029 * cache when it has not been accessed. 030 * <p> 031 * This defaults to 0 which means unlimited. 032 * </p> 033 */ 034 int maxIdleSecs() default 0; 035 036 /** 037 * The maximum time (in seconds) a cache entry is allowed to stay in the 038 * cache. 039 * <p> 040 * This is not generally required as the cache entries are automatically 041 * evicted when related data changes are committed. 042 * </p> 043 * <p> 044 * This defaults to 0 which means unlimited. 045 * </p> 046 */ 047 int maxSecsToLive() default 0; 048 049 /** 050 * The frequency (in seconds) that cache trimming should occur. 051 * <p> 052 * This is a hint for cache implementations that use background cache trimming. 053 * </p> 054 */ 055 int trimFrequency() default 0; 056}