Package javax.cache

Examples of javax.cache.CacheFactory.createCache()


    try {
      @SuppressWarnings("rawtypes")
      Map props = new HashMap();
      props.put(GCacheFactory.EXPIRATION_DELTA, 3600*24); // cache expires in one day
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(props);
    } catch (CacheException e) {
      log.severe("Error initialising station storage. Cache is not used!: " + e.toString());
    }
  }

View Full Code Here


    try {
      @SuppressWarnings("rawtypes")
      Map props = new HashMap();
      props.put(GCacheFactory.EXPIRATION_DELTA, 3600*24); // cache expires in one day
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(props);
    } catch (CacheException e) {
      log.severe("Error initialising station storage. Cache is not used!: " + e.toString());
    }
  }

View Full Code Here

    Cache cache;

  public MediaFactory() {
      try {
          CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
          cache = cacheFactory.createCache(Collections.emptyMap());
      } catch (CacheException e) {
          log.severe(e.getMessage());
      }
  }
View Full Code Here

    Cache cache;

  public SourceFactory() {
      try {
          CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
          cache = cacheFactory.createCache(Collections.emptyMap());
      } catch (CacheException e) {
          log.severe(e.getMessage());
      }
  }
View Full Code Here

   * @throws CacheException If there is a problem connecting to Google App
   *     Engine Memcache.
   */
  public WaveSubmittedTweetsCache() throws CacheException {
    CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
    this.cache = cacheFactory.createCache(Collections.emptyMap());
  }

  /**
   * Adds a tweet id to a list of known tweet ids for the given wave.
   *
 
View Full Code Here

      try {
        // log.log(level, "1");
        CacheFactory cacheFactory = CacheManager.getInstance()
            .getCacheFactory();
        // log.log(level, "2");
        cache = cacheFactory.createCache(Collections.emptyMap());
        // log.log(level, "3");
        // Get the value from the cache.
        object = (HashMap<String, Object>) cache.get(clazz
            + Long.toString(id));
        // log.log(level, "4");
View Full Code Here

        try {
          // log.log(level, "1");
          CacheFactory cacheFactory = CacheManager.getInstance()
              .getCacheFactory();
          // log.log(level, "2");
          cache = cacheFactory.createCache(Collections.emptyMap());
          // log.log(level, "3");
          cache.put(clazz + id, object);
          // log.info("put " + clazz + " " + id + " in memcache");
        } catch (CacheException ce) {
          // exception handling
View Full Code Here

    // consultar si el resultado est� en la cache
    try {
      Map<Integer, Integer> props = new HashMap<Integer, Integer>();
      props.put(GCacheFactory.EXPIRATION_DELTA, 1800);
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      Cache cache = cacheFactory.createCache(Collections.emptyMap());

      List<FeaturedArticle> articles = (List<FeaturedArticle>) cache.get(FEATURED_ARTICLES_KEY);

      if (articles == null) {
        // si no esta, buscar los 5 art�culos con m�s comentarios
View Full Code Here

        Map config = createConfig(name);
        Map wrappedConfig = new HashMap(config);
        wrappedConfig.put("cache-name", name);
        CacheFactory factory = manager.getCacheFactory();
        cache = factory.createCache(wrappedConfig);
        manager.registerCache(name, cache);
        return cache;
    }

    public boolean evictCache(String name) {
View Full Code Here

      // Try to get the memcache
      if (cache == null) {
        try {
          CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
          cache = cacheFactory.createCache(Collections.emptyMap());
        } catch (CacheException e) {
          log.warning("Exception retrieving memcache instance: " + e);
        }
      }
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.