Examples of MRUAlgorithmConfig


Examples of org.jboss.cache.eviction.MRUAlgorithmConfig

    */
   private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
            int maxNodes, long minTimeToLive)
      throws ExoCacheInitException
   {
      final MRUAlgorithmConfig mru = new MRUAlgorithmConfig(maxNodes);
      mru.setMinTimeToLive(minTimeToLive);
      Fqn<String> rooFqn = addEvictionRegion(config, cache, mru);
      return new AbstractExoCache<Serializable, Object>(config, cache, rooFqn)
      {

         public void setMaxSize(int max)
         {
            mru.setMaxNodes(max);
         }

         public void setLiveTime(long period)
         {
            mru.setMinTimeToLive(period);
         }

         @ManagedName("MaxNodes")
         @ManagedDescription("This is the maximum number of nodes allowed in this region. " +
               "0 denotes immediate expiry, -1 denotes no limit.")
         public int getMaxSize()
         {
            return mru.getMaxNodes();
         }

         @ManagedName("MinTimeToLive")
         @ManagedDescription("the minimum amount of time a node must be allowed to live after " +
               "being accessed before it is allowed to be considered for eviction. " +
               "0 denotes that this feature is disabled, which is the default value.")
         public long getLiveTime()
         {
            return mru.getMinTimeToLive();
         }
      };
   }
View Full Code Here

Examples of org.jboss.cache.eviction.MRUAlgorithmConfig

    */
   private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache, int maxNodes, long minTimeToLive)
      throws ExoCacheInitException
   {
      final Configuration configuration = cache.getConfiguration();
      final MRUAlgorithmConfig mru = new MRUAlgorithmConfig(maxNodes);
      mru.setMinTimeToLive(minTimeToLive);
      // Create an eviction region config
      final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, mru);

      final EvictionConfig evictionConfig = configuration.getEvictionConfig();
      evictionConfig.setDefaultEvictionRegionConfig(erc);

      return new AbstractExoCache<Serializable, Object>(config, cache)
      {

         public void setMaxSize(int max)
         {
            mru.setMaxNodes(max);
         }

         public void setLiveTime(long period)
         {
            mru.setMinTimeToLive(period);
         }

         @ManagedName("MaxNodes")
         @ManagedDescription("This is the maximum number of nodes allowed in this region. 0 denotes immediate expiry, -1 denotes no limit.")
         public int getMaxSize()
         {
            return mru.getMaxNodes();
         }

         @ManagedName("MinTimeToLive")
         @ManagedDescription("the minimum amount of time a node must be allowed to live after being accessed before it is allowed to be considered for eviction. 0 denotes that this feature is disabled, which is the default value.")
         public long getLiveTime()
         {
            return mru.getMinTimeToLive();
         }
      };
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.