Examples of Cache


Examples of opennlp.tools.util.Cache

  private long numberOfCacheHits;
  private long numberOfCacheMisses;

  public CachedFeatureGenerator(AdaptiveFeatureGenerator... generators) {
    this.generator = new AggregatedFeatureGenerator(generators);
    contextsCache = new Cache(100);
  }

Examples of org.apache.abdera.protocol.client.cache.Cache

  public Cache getCache() {
    return cache;
  }
 
  public Cache initCache(CacheFactory factory) {
    Cache cache = null;
    if (factory != null) cache = factory.getCache(abdera);
    return (cache != null) ? cache : new LRUCache(abdera);
  }

Examples of org.apache.archiva.redback.components.cache.Cache

            // Setup some defaults.
            hints = new CacheHints();
            hints.setName( id );
        }

        Cache cache = CacheFactory.creator.createCache( hints );

        caches.put( id, cache );
        return (Cache) cache;
    }

Examples of org.apache.blur.store.blockcache.Cache

    // in a slab when using a block size of 8,192
    int numberOfBlocksPerSlab = 16384;
    int blockSize = BlockDirectory.BLOCK_SIZE;
    int slabCount = configuration.getInt(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT, -1);
    slabCount = getSlabCount(slabCount, numberOfBlocksPerSlab, blockSize);
    Cache cache;
    if (slabCount >= 1) {
      BlockCache blockCache;
      boolean directAllocation = configuration.getBoolean(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, true);

      int slabSize = numberOfBlocksPerSlab * blockSize;
 

Examples of org.apache.chemistry.opencmis.client.bindings.cache.Cache

        // no keys
        assertNull(cache.get((String[]) null));
    }

    public void testCacheConfig() throws Exception {
        Cache cache;

        // empty config
        try {
            cache = new CacheImpl();
            cache.initialize(new String[] {});
        } catch (IllegalArgumentException e) {
        }

        // null config
        try {
            cache = new CacheImpl();
            cache.initialize(null);
        } catch (IllegalArgumentException e) {
        }

        // unknown class
        try {
            cache = new CacheImpl();
            cache.initialize(new String[] { "this.is.not.a.valid.class" });
        } catch (IllegalArgumentException e) {
        }

        // not a CacheLevel class
        try {
            cache = new CacheImpl();
            cache.initialize(new String[] { "org.apache.chemistry.opencmis.client.provider.cache.CacheTest" });
        } catch (IllegalArgumentException e) {
        }
    }

Examples of org.apache.chemistry.opencmis.client.runtime.cache.Cache

    public void setup() {
    }

    @Test
    public void cacheSingleObjectTest() {
        Cache cache = CacheImpl.newInstance();

        String id = "1";
        // String path = "/1";
        String cacheKey = "key";

        // add object
        CmisObject obj1 = this.createCmisObject(id);
        cache.put(obj1, cacheKey);

        // access object
        Assert.assertTrue(cache.containsId(id, cacheKey));

        // access object
        CmisObject obj2 = cache.getById(id, cacheKey);
        Assert.assertEquals(obj1, obj2);

        // clear cache
        cache.clear();

        // access object (not found)
        Assert.assertFalse(cache.containsId(id, cacheKey));

        // access object (not found)
        CmisObject obj4 = cache.getById(id, cacheKey);
        Assert.assertNull(obj4);
    }

Examples of org.apache.cocoon.caching.Cache

                    SourceResolver resolver,
                    Map objectModel,
                    String src,
                    Parameters par
    ) throws Exception {
        Cache cache = (Cache)this.manager.lookup(Cache.ROLE);

        try {
            cache.clear();
            return EMPTY_MAP;
        } catch (Exception ex) {
      if (this.getLogger().isDebugEnabled()) {
                getLogger().debug("Exception while trying to Clear Cache", ex);
            }

Examples of org.apache.ibatis.cache.Cache

  public Cache useCacheRef(String namespace) {
    if (namespace == null) {
      throw new BuilderException("cache-ref element requires a namespace attribute.");
    }
    Cache cache = configuration.getCache(namespace);
    if (cache == null) {
      throw new BuilderException("No cache for namespace '" + namespace + "' could be found.");
    }
    currentCache = cache;
    return cache;

Examples of org.apache.lucene.util.cache.Cache

    ensureIndexIsRead();

    TermInfo ti;
    ThreadResources resources = getThreadResources();
    Cache cache = null;
   
    if (useCache) {
      cache = resources.termInfoCache;
      // check the cache first if the term was recently looked up
      ti = (TermInfo) cache.get(term);
      if (ti != null) {
        return ti;
      }
    }
   
    // optimize sequential access: first try scanning cached enum w/o seeking
    SegmentTermEnum enumerator = resources.termEnum;
    if (enumerator.term() != null                 // term is at or past current
  && ((enumerator.prev() != null && term.compareTo(enumerator.prev())> 0)
      || term.compareTo(enumerator.term()) >= 0)) {
      int enumOffset = (int)(enumerator.position/totalIndexInterval)+1;
      if (indexTerms.length == enumOffset    // but before end of block
    || term.compareTo(indexTerms[enumOffset]) < 0) {
       // no need to seek

        int numScans = enumerator.scanTo(term);
        if (enumerator.term() != null && term.compareTo(enumerator.term()) == 0) {
          ti = enumerator.termInfo();
          if (cache != null && numScans > 1) {
            // we only  want to put this TermInfo into the cache if
            // scanEnum skipped more than one dictionary entry.
            // This prevents RangeQueries or WildcardQueries to
            // wipe out the cache when they iterate over a large numbers
            // of terms in order
            cache.put(term, ti);
          }
        } else {
          ti = null;
        }

        return ti;
     
    }

    // random-access: must seek
    seekEnum(enumerator, getIndexOffset(term));
    enumerator.scanTo(term);
    if (enumerator.term() != null && term.compareTo(enumerator.term()) == 0) {
      ti = enumerator.termInfo();
      if (cache != null) {
        cache.put(term, ti);
      }
    } else {
      ti = null;
    }
    return ti;

Examples of org.apache.olio.webapp.cache.Cache

        queryMap.put("day", day);
        queryMap.put("month", month);
        queryMap.put("year", year);
        queryMap.put("orderBy", orderBy);

        Cache cache = WebappUtil.getCache();
        if (cache != null) {
            String cacheKey = WebappUtil.getCacheKey("/event/list", queryMap);
            if (cacheKey != null) {

                Object cobj = null;

                CachedList cl = (CachedList)cache.get(cacheKey);

                if (cl == null) {
                    // nothing in cache
                    cl = new CachedList(cacheKey);

                    // get a new cacheable page/partial
                    cobj = createCachePageObject(queryMap, response, request, mf);
                    cl.put(index, cobj);


                    if (cache.needsRefresh(false, cacheKey)) {
                        cache.put(cacheKey, cl, CacheFactory.getInstance().getCacheExpireInSeconds());
                        cache.doneRefresh(cacheKey, CacheFactory.getInstance().getCacheLockExpireInSeconds());
                    }

                } else {
                    // something in the cache
                    cobj = cl.get(index); // we are using this whatever

                    Object newCobj = createCachePageObject(queryMap, response, request, mf);
                    cl.put(index, newCobj); // replaces existing value
                     if (cache.needsRefresh(true, cacheKey)) {
                        cache.put(cacheKey, cl, CacheFactory.getInstance().getCacheExpireInSeconds());
                        cache.doneRefresh(cacheKey, CacheFactory.getInstance().getCacheLockExpireInSeconds());
                    }
                }

                if (cobj != null) {
                    request.setAttribute("content", cobj);
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.