Examples of Cache


Examples of KFM.Cache

    {
        // *** Slightly adapted Cut&Paste from testAdd() BEGIN
        int tCacheMaxSize = 100000; // bytes
        int tCacheMaxLifetime = -1; // never expire
        emptyCacheDir();
        Cache tMemoryCache = new Cache(tCacheMaxSize, tCacheMaxLifetime);

        // write html to cache
        String tCacheKey = "cachedfile.html";
        String tHTML = "<html>very short HTML</html>";
        Cacheable tCacheItem = new CachedHTMLItem(tHTML, tCacheKey);
        tMemoryCache.add(tCacheKey, tCacheItem);

        // get html from cache
        tCacheItem = tMemoryCache.get(tCacheKey);
        String tCachedContent = ((CachedHTMLItem) tCacheItem).getHTML().trim();
        assertTrue("Could not retrieve cashed item: " + tCacheKey, tCacheItem != null);
        assertTrue("Cached item doen't contain expected content: " + tCachedContent, tCachedContent.equals(tHTML));
        // *** Slightly adapted Cut&Paste from testAdd() END
    }

Examples of br.net.woodstock.rockframework.cache.Cache

  public Cache create(final String id) {
    Assert.notEmpty(id, "id");
    if (this.contains(id)) {
      throw new IllegalArgumentException("A cache with name " + id + " already exists");
    }
    Cache c = new MemoryCacheImpl(id);
    this.caches.add(c);
    return c;
  }

Examples of br.net.woodstock.rockframework.core.cache.Cache

  public Cache create(final String id) {
    Assert.notEmpty(id, "id");
    if (this.contains(id)) {
      throw new IllegalArgumentException("A cache with name " + id + " already exists");
    }
    Cache c = new MemoryCacheImpl(id);
    this.caches.add(c);
    return c;
  }

Examples of ca.grimoire.jnoise.modules.util.Cache

   * @throws BuilderException
   *           if the source module builder throws an exception.
   * @see ModuleBuilder#createModule()
   */
  public Cache createModule () throws BuilderException {
    return new Cache (createSource ());
  }

Examples of cc.concurrent.mango.Cache

        return cacheDescriptor.getPropertyPath();
    }

    private void buildCacheDescriptor(Method method) {
        Class<?> daoClass = method.getDeclaringClass();
        Cache cacheAnno = daoClass.getAnnotation(Cache.class);
        cacheDescriptor = new CacheDescriptor();
        if (cacheAnno != null) { // dao类使用cache
            CacheIgnored cacheIgnoredAnno = method.getAnnotation(CacheIgnored.class);
            if (cacheIgnoredAnno == null) { // method不禁用cache
                cacheDescriptor.setUseCache(true);
                cacheDescriptor.setPrefix(cacheAnno.prefix());
                cacheDescriptor.setExpire(Reflection.instantiate(cacheAnno.expire()));
                cacheDescriptor.setNum(cacheAnno.num());
                Annotation[][] pass = method.getParameterAnnotations();
                int num = 0;
                for (int i = 0; i < pass.length; i++) {
                    Annotation[] pas = pass[i];
                    for (Annotation pa : pas) {

Examples of com.Yasna.util.Cache

    public ForumPermissions getPermissions(Authorization authorization) {
        int userID = authorization.getUserID();

        //Get the user perm cache for this forum
        Cache userPermCache = (Cache)factory.getCacheManager().get(
            DbCacheManager.USER_PERMS_CACHE,
            new Integer(id)
        );

        //Simple case: if cache is turned on and the user is already cached,
        //we can simply return the cached permissions.
        if (userPermCache != null) {
            ForumPermissions permissions =
                    (ForumPermissions)userPermCache.get(new Integer(userID));
            if (permissions != null) {
                return permissions;
            }
        }

        //Not so simple case: cache is not turned on or the user permissions
        //have not been cached yet.
        boolean isAnonymous = (userID == -1);
        boolean isUser = !isAnonymous;

        ForumPermissions finalPermissions = ForumPermissions.none();

        //Step 1 - Get permissions for the User. This includes anonymous
        //perms, "special user" perms, and the specific perms for the user.
        if (isUser) {
            ForumPermissions userPermissions = factory.getUserPermissions(userID, id);
            //Combine permissions
            finalPermissions = new ForumPermissions(finalPermissions, userPermissions);
        }
        //Add in anonymous perms.
        ForumPermissions anonyPermissions = null;
        if (userPermCache != null) {
            anonyPermissions = (ForumPermissions)userPermCache.get(new Integer(-1));
        }
        //Otherwise, do our own lookup.
        if (anonyPermissions == null) {
            anonyPermissions = factory.getUserPermissions(-1, id);
            //Add to cache so it will be there next time.
            if (userPermCache != null) {
                userPermCache.add(new Integer(-1), anonyPermissions);
            }
        }
        //Combine permissions
        finalPermissions = new ForumPermissions(finalPermissions, anonyPermissions);

        //If they are a valid user, figure out "any user" permissions.
        if (isUser) {
            ForumPermissions specialUserPermissions = null;
            //Check for cache
            if (userPermCache != null) {
                specialUserPermissions = (ForumPermissions)userPermCache.get(new Integer(0));
            }
            //Otherwise, do our own lookup.
            if (specialUserPermissions == null) {
                specialUserPermissions = factory.getUserPermissions(0, id);
                //Add to cache so it will be there next time.
                if (userPermCache != null) {
                    userPermCache.add(new Integer(0), specialUserPermissions);
                }
            }
            //Combine permissions
            finalPermissions = new ForumPermissions(finalPermissions, specialUserPermissions);
        }

        //Step 2 -- get Permissions for all groups the user is in.
        int [] groups = ((DbProfileManager)factory.getProfileManager()).getUserGroups(userID);
        for (int i=0; i<groups.length; i++) {
            ForumPermissions groupPermissions = factory.getGroupPermissions(groups[i], id);
            finalPermissions = new ForumPermissions(finalPermissions, groupPermissions);
        }

        //Finally, add user to cache so it will be there next time.
        if (isUser && userPermCache != null) {
            userPermCache.add(new Integer(userID), finalPermissions);
        }

        return finalPermissions;
    }

Examples of com.alibaba.dubbo.cache.Cache

        this.cacheFactory = cacheFactory;
    }

    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        if (cacheFactory != null && ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.CACHE_KEY))) {
            Cache cache = cacheFactory.getCache(invoker.getUrl().addParameter(Constants.METHOD_KEY, invocation.getMethodName()));
            if (cache != null) {
                String key = StringUtils.toArgumentString(invocation.getArguments());
                if (cache != null && key != null) {
                    Object value = cache.get(key);
                    if (value != null) {
                        return new RpcResult(value);
                    }
                    Result result = invoker.invoke(invocation);
                    if (! result.hasException()) {
                        cache.put(key, result.getValue());
                    }
                    return result;
                }
            }
        }

Examples of com.alvazan.orm.api.z8spi.Cache

  }
 
  @Override
  public AbstractCursor<KeyValue<Row>> find(DboTableMeta colFamily,
      DirectCursor<byte[]> rowKeys, boolean skipCache, boolean cacheResults, Integer batchSize) {
    Cache c = new EmptyCache(this, skipCache, cacheResults);
   
    //NOTE: I would put a finally to clear out the threadlocal normally BUT sometimes log statements may
    //cause further finds to be called which come in here as well and on their way BACK up the stack, they set
    //the cache to NULL before the find actually happens(ie. very bad).
    CacheThreadLocal.setCache(c);

Examples of com.atlassian.cache.Cache

   
   

  protected AdvancedCodeBlockCache getFromCache(String innerKeyCacheName) {
    if (innerKeyCacheName != null && ! innerKeyCacheName.isEmpty()) {
      Cache cache = cacheManager.getCache(MACRO_CACHE_KEY);   
 
      AdvancedCodeBlockCache cacheObj = null;
      try {
        cacheObj = (AdvancedCodeBlockCache) cache.get(innerKeyCacheName);
      } catch (Exception e) {
        // If Object of old version with different footprint is already there, discard the object.
        log.info("Cache gets renewed because of ClassCastException."+e.getMessage());
        cacheObj = null;
      }

Examples of com.bah.lucene.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, totalNumberOfBytes);
    Cache cache;
    if (slabCount >= 1) {
      BlockCache blockCache;
      boolean directAllocation = configuration.getBoolean(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, true);

      int slabSize = numberOfBlocksPerSlab * blockSize;
 
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.