Examples of CacheValue


Examples of com.starflow.wf.core.key.CacheValue

    this.updateSQL = "UPDATE WF_PRIMARYKEY SET code = code + ? WHERE name = ? ";
    this.insertSQL = "INSERT INTO WF_PRIMARYKEY (code, name) VALUES (?, ?)";
  }

  public CacheValue getCacheValue(int cacheNum, String name) {
    CacheValue cache = null;
    try {
      cache = getCurrCode(name);
     
      if(cache == null) {
        insert(name);
            cache = getCurrCode(name);
      }
     
      update(cacheNum, name);
        cache.setMaxVal(cache.getMinVal() + cacheNum);
    } catch(Exception e) {
      logger.error("获取主键失败", e);
    }
    return cache;
  }
View Full Code Here

Examples of com.starflow.wf.core.key.CacheValue

    }
    return cache;
  }
 
  private CacheValue getCurrCode(String name) {
    CacheValue value = null;
    try {
      Long code = jdbcTemplate.queryForLong(this.selectSQL, new Object[] {name});
      value = new CacheValue();
      value.setMinVal(code + 1);
    } catch (EmptyResultDataAccessException e) {
      logger.debug(name + " 没有找到记录");
    } catch (Exception e) {
      throw new UniqueException(name + " 获取主键失败");
    }
View Full Code Here

Examples of org.apache.blur.store.blockcache_v2.CacheValue

  public CacheValue detachFromCache() {
    if (_baseCacheValue instanceof ByteArrayCacheValue) {
      // already detached
      return null;
    } else if (_baseCacheValue instanceof UnsafeCacheValue) {
      final CacheValue result = _baseCacheValue;
      if (get() == 0) {
        // No one is using this so don't copy
        // NULL out reference so just in case there can't be a seg fault.
        _baseCacheValue = null;
      } else {
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

        // construct the current cache key
        this.cacheKey = this.constructCacheKey();

        // check for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null) {
            // cached value found -> write it
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }
            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());

            if (!this.isCacheKeyValid(cachedValue)) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
                }
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Used cache: " + this.cache);
        }

        // checked for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (this.isCacheKeyValid(cachedValue)) {
            // cached value found
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }

            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
            return;
        }

        // execute the pipeline
        this.invokeStarter();
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

        if (this.cache == null) {
            this.logger.warn("Caching pipeline has no cache configured. Falling back to non-caching behavior.");
            return null;
        }

        CacheValue cacheValue = this.cache.get(cacheKey, true);
        if (this.logger.isDebugEnabled()) {
            if (cacheValue != null) {
                this.logger.debug("Retrieved content from cache: " + cacheValue);
            } else {
                this.logger.debug("No cache value available for " + cacheKey);
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

     */
    @ManagedOperation(description = "Returns size of this cache")
    public final String size() {
        double result = 0;
        for (CacheKey key : this.cache.keySet()) {
            CacheValue cacheValue = this.cache.get(key);
            if (cacheValue != null) { // prevent from NullPointerException
                double size = cacheValue.size();
                if (size != -1) {
                    result += size;
                }
            }
        }
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

        int points = this.countPoints(minSize, maxSize, minLastModify, maxLastModify, minExpires, maxExpires);

        for (Cache cache : this.caches) {
            for (CacheKey cacheKey : cache.keySet()) {
                int score = 0;
                CacheValue cacheValue = cache.get(cacheKey);
                if (cacheValue == null) { // prevent from NullPointerException
                    continue;
                }

                // check minSize condition
                if (minSize >= 0 && cacheValue.size() >= minSize) {
                    // if minSize condition is set (it value is < 0) and it is not fulfilled we skip this element
                    score++;
                }

                // check maxSize condition
                if (maxSize >= 0 && cacheValue.size() <= maxSize) {
                    score++;
                }

                Date lastModifyDate = new Date(cacheKey.getLastModified());
                if (minLastModify != null && lastModifyDate.compareTo(minLastModify) >= 0) {
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

        // construct the current cache key
        this.cacheKey = this.constructCacheKey();

        // check for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null) {
            // cached value found -> write it
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }
            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());

            if (!cachedValue.isValid(this.cacheKey)) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
                }
                // the cached value is not valid -> refresh the value
                this.cacheRefreshManager.refreshCacheValue(this.cacheKey, this);
View Full Code Here

Examples of org.apache.cocoon.pipeline.caching.CacheValue

            this.logger.debug("Used cache: " + this.pipelineCache);
        }

        this.cacheKey = this.constructCacheKey();
        // checked for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null && cachedValue.isValid(this.cacheKey)) {
            // cached value found
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }

            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
            return;
        }

        // execute the pipeline
        this.invokeStarter();
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.