Package com.avaje.ebean.cache

Examples of com.avaje.ebean.cache.ServerCacheOptions


  }


  public ServerCacheOptions getOptions() {
    synchronized (monitor) {
      ServerCacheOptions o = new ServerCacheOptions();
      o.setMaxIdleSecs(maxIdleSecs);
      o.setMaxSize(maxSize);
      o.setMaxSecsToLive(maxSecsToLive);
      return o;
    }
  }
View Full Code Here


      return cache;
    }
    synchronized (monitor) {
      cache = synchMap.get(cacheKey);
      if (cache == null) {
        ServerCacheOptions options = getCacheOptions(cacheKey);
        cache = cacheFactory.createCache(cacheKey, options);
        synchMap.put(cacheKey, cache);
        concMap.put(cacheKey, cache);
      }
      return cache;
View Full Code Here

      // read the deployment annotation
      try {
        Class<?> cls = Class.forName(beanType);
        CacheTuning cacheTuning = cls.getAnnotation(CacheTuning.class);
        if (cacheTuning != null) {
          ServerCacheOptions o = new ServerCacheOptions(cacheTuning);
          o.applyDefaults(defaultOptions);
          return o;
        }
      } catch (ClassNotFoundException e){
        // ignore
      }
View Full Code Here

    if (serverCacheManager != null) {
      return serverCacheManager;
    }

    // reasonable default settings are for a cache per bean type
    ServerCacheOptions beanOptions = new ServerCacheOptions();
    beanOptions.setMaxSize(GlobalProperties.getInt("cache.maxSize", 1000));
    // maxIdleTime 10 minutes
    beanOptions.setMaxIdleSecs(GlobalProperties.getInt("cache.maxIdleTime", 60 * 10));
    // maxTimeToLive 6 hrs
    beanOptions.setMaxSecsToLive(GlobalProperties.getInt("cache.maxTimeToLive", 60 * 60 * 6));

    // reasonable default settings for the query cache per bean type
    ServerCacheOptions queryOptions = new ServerCacheOptions();
    queryOptions.setMaxSize(GlobalProperties.getInt("querycache.maxSize", 100));
    // maxIdleTime 10 minutes
    queryOptions.setMaxIdleSecs(GlobalProperties.getInt("querycache.maxIdleTime", 60 * 10));
    // maxTimeToLive 6 hours
    queryOptions.setMaxSecsToLive(GlobalProperties.getInt("querycache.maxTimeToLive", 60 * 60 * 6));

    ServerCacheFactory cacheFactory = serverConfig.getServerCacheFactory();
    if (cacheFactory == null) {
      cacheFactory = new DefaultServerCacheFactory();
    }
View Full Code Here

TOP

Related Classes of com.avaje.ebean.cache.ServerCacheOptions

Copyright © 2018 www.massapicom. 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.