Examples of CacheKey


Examples of com.springsource.insight.plugin.files.tracker.AbstractFilesTrackerAspectSupport.CacheKey

    public void testFilesCacheSize() {
        final int MAX_CAPACITY = 16;
        FilesCache cache = new FilesCache(MAX_CAPACITY);

        for (int index = 0; index < 2 * MAX_CAPACITY; index++) {
            CacheKey key = CacheKey.getFileKey(Mockito.mock(Closeable.class));
            assertNull("Multiple mappings for " + key, cache.put(key, String.valueOf(index)));

            if (index < MAX_CAPACITY) {
                assertEquals("Mismatched pre-populated cache size", index + 1, cache.size());
            } else {
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.cache.CacheKey

        // initialize the process
        process = new CacheBodyOperationProcess();
        cache = cacheProcessConfig.getCache("cacheName");
        process.setCache(cache);
        process.setCacheName("cacheName");
        cacheKey = new CacheKey();
        cacheKey.addKey("cacheKey");
        process.setCacheKey(cacheKey);
        process.setPipeline(pipeline);

        dependencies = new Dependency[1];
View Full Code Here

Examples of honeycrm.client.prefetch.CacheKey

  public void testKey() {
    final long someRandomLong = r.nextLong();

    assertFalse(new Object[] { 1, 2 }.hashCode() == new Object[] { 1, 2 }.hashCode());

    final CacheKey c = new CacheKey(Dto.class, Dto.class, someRandomLong);
    final CacheKey d = new CacheKey(Dto.class, Dto.class, someRandomLong);
    final CacheKey e = new CacheKey(Dto.class, Dto.class, someRandomLong + 1);

    assertTrue(c.equals(d));
    assertFalse(c.equals(e));
    assertFalse(d.equals(e));

    final Set<CacheKey> set = new HashSet<CacheKey>();
    assertTrue(set.isEmpty());

    // add 1st item
    set.add(c);
    assertEquals(1, set.size());
    set.add(c);
    assertEquals(1, set.size());

    // add 2nd item
    set.add(e);
    set.add(d);
    set.add(d);
    set.add(e);
    set.add(new CacheKey(Dto.class, Dto.class, someRandomLong + 1));
    set.add(new CacheKey(Dto.class, Dto.class, someRandomLong));
    assertEquals(2, set.size());
  }
View Full Code Here

Examples of javax.cache.annotation.CacheKey

      }

      final CacheKeyInvocationContext<CachePut> cacheKeyInvocationContext = contextFactory.getCacheKeyInvocationContext(invocationContext);
      final CacheKeyGenerator cacheKeyGenerator = cacheKeyInvocationContext.unwrap(CacheKeyInvocationContextImpl.class).getCacheKeyGenerator();
      final CachePut cachePut = cacheKeyInvocationContext.getCacheAnnotation();
      final CacheKey cacheKey = cacheKeyGenerator.generateCacheKey(cacheKeyInvocationContext);
      final Cache<CacheKey, Object> cache = cacheResolver.resolveCache(cacheKeyInvocationContext);

      final Object valueToCache = cacheKeyInvocationContext.getValueParameter().getValue();

      if (!cachePut.afterInvocation() && valueToCache != null) {
View Full Code Here

Examples of oracle.toplink.essentials.internal.identitymaps.CacheKey

        if (query.getObjectChangeSet() == null) {
            Object objectInMemory = getRealAttributeValueFromObject(query.getObject(), query.getSession());
   
            // delete the object in the database if it is no more a referenced object.           
            if (objectInDatabase != objectInMemory) {
                CacheKey cacheKeyForObjectInDatabase = null;
                CacheKey cacheKeyForObjectInMemory = new CacheKey(new Vector());
   
                cacheKeyForObjectInDatabase = new CacheKey(getPrimaryKeyForObject(objectInDatabase, query.getSession()));
   
                if (objectInMemory != null) {
                    cacheKeyForObjectInMemory = new CacheKey(getPrimaryKeyForObject(objectInMemory, query.getSession()));
                }
   
                if (cacheKeysAreEqual(cacheKeyForObjectInDatabase, cacheKeyForObjectInMemory)) {
                    return;
                }
View Full Code Here

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

        // collect ETag
        final String noneMatch = getIfNoneMatch();
        if (pipeline instanceof CachingPipeline) {
            CachingPipeline<PipelineComponent> cachingPipeline = (CachingPipeline<PipelineComponent>) pipeline;
            CacheKey cacheKey = cachingPipeline.getCacheKey();
            if (cacheKey != null) {
                setETag(Integer.toHexString(cacheKey.hashCode()));
            }
        }

        // set last-modified
        if (lastModified > -1 || getLastModified() <= 0) {
View Full Code Here

Examples of org.apache.ibatis.cache.CacheKey

    ErrorContext.instance().resource(ms.getResource()).activity("executing a query").object(ms.getId());
    if (closed) throw new ExecutorException("Executor was closed.");
    List list;
    try {
      queryStack++;
      CacheKey key = createCacheKey(ms, parameter, rowBounds);
      list = resultHandler == null ? (List) localCache.getObject(key) : null;
      if (list != null) {
        handleLocallyCachedOutputParameters(ms, key, parameter);
      } else {
        list = queryFromDatabase(ms, parameter, rowBounds, resultHandler, key);
View Full Code Here

Examples of org.apache.ibatis.cache.CacheKey

  }

  public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
    if (closed) throw new ExecutorException("Executor was closed.");
    BoundSql boundSql = ms.getBoundSql(parameterObject);
    CacheKey cacheKey = new CacheKey();
    cacheKey.update(ms.getId());
    cacheKey.update(rowBounds.getOffset());
    cacheKey.update(rowBounds.getLimit());
    cacheKey.update(boundSql.getSql());
    List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
    if (parameterMappings.size() > 0 && parameterObject != null) {
      TypeHandlerRegistry typeHandlerRegistry = ms.getConfiguration().getTypeHandlerRegistry();
      if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
        cacheKey.update(parameterObject);
      } else {
        MetaObject metaObject = configuration.newMetaObject(parameterObject);
        for (ParameterMapping parameterMapping : parameterMappings) {
          String propertyName = parameterMapping.getProperty();
          if (metaObject.hasGetter(propertyName)) {
            cacheKey.update(metaObject.getValue(propertyName));
          } else if (boundSql.hasAdditionalParameter(propertyName)) {
            cacheKey.update(boundSql.getAdditionalParameter(propertyName));
          }
        }
      }
    }
    return cacheKey;
View Full Code Here

Examples of org.apache.ibatis.cache.CacheKey

    final MappedStatement nestedQuery = configuration.getMappedStatement(nestedQueryId);
    final Class nestedQueryParameterType = nestedQuery.getParameterMap().getType();
    final Object nestedQueryParameterObject = prepareParameterForNestedQuery(rs, propertyMapping, nestedQueryParameterType);
    Object value = null;
    if (nestedQueryParameterObject != null) {
      final CacheKey key = executor.createCacheKey(nestedQuery, nestedQueryParameterObject, RowBounds.DEFAULT);
      if (executor.isCached(nestedQuery, key)) {
        executor.deferLoad(nestedQuery, metaResultObject, property, key);
      } else {
        final ResultLoader resultLoader = new ResultLoader(configuration, executor, nestedQuery, nestedQueryParameterObject, propertyMapping.getJavaType());
        if (configuration.isLazyLoadingEnabled()) {
View Full Code Here

Examples of org.apache.ibatis.cache.CacheKey

  protected void handleRowValues(ResultSet rs, ResultMap resultMap, ResultHandler resultHandler, RowBounds rowBounds) throws SQLException {
    final DefaultResultContext resultContext = new DefaultResultContext();
    skipRows(rs, rowBounds);
    while (shouldProcessMoreRows(rs, resultContext, rowBounds)) {
      final ResultMap discriminatedResultMap = resolveDiscriminatedResultMap(rs, resultMap);
      final CacheKey rowKey = createRowKey(discriminatedResultMap, rs);
      final boolean knownValue = globalRowValueCache.containsKey(rowKey);
      Object rowValue = getRowValue(rs, discriminatedResultMap, rowKey);
      if (!knownValue) {
        resultContext.nextResultObject(rowValue);
        resultHandler.handleResult(resultContext);
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.