All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.eviction.EvictionStrategy Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.eviction;

/**
 * Supported eviction strategies
 *
 * @author Manik Surtani
 * @since 4.0
 */
public enum EvictionStrategy {
   /**
    * Eviction Strategy where nothing is done by the cache and the user is probably not going to use eviction manually
    */
   NONE(false, false),
   /**
    * Strategy where the cache does nothing but the user is assumed to manually invoke evict method
    */
   MANUAL(false, false),
   /**
    * Strategy where the cache will remove entries to make room for new ones while staying under the configured size
    */
   REMOVE(false, true),
   /**
    * Strategy where the cache will block new entries from being written if they would exceed the configured size
    */
   EXCEPTION(true, false),
   ;

   private final boolean exception;
   private final boolean removal;

   EvictionStrategy(boolean exception, boolean removal) {
      this.exception = exception;
      this.removal = removal;
   }

   /**
    * Whether or not the cache will do something due to the strategy
    * @return
    */
   public boolean isEnabled() {
      return this != NONE && this != MANUAL;
   }

   /**
    * The cache will throw exceptions to prevent memory growth
    * @return
    */
   public boolean isExceptionBased() {
      return exception;
   }

   /**
    * The cache will remove other entries to make room to limit memory growth
    * @return
    */
   public boolean isRemovalBased() {
      return removal;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy