Examples of QueryCache


Examples of org.apache.blur.utils.QueryCache

  private ExecutorService _dataFetch;
  private String _cluster = BlurConstants.BLUR_CLUSTER;
  private int _dataFetchThreadCount = 32;

  public void init() throws BlurException {
    _queryCache = new QueryCache("shard-cache", _maxQueryCacheElements, _maxTimeToLive);
    _dataFetch = Executors.newThreadPool("data-fetch-", _dataFetchThreadCount);

    if (_configuration == null) {
      throw new BException("Configuration must be set before initialization.");
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        if (!cacheOrCacheRefresh) {
            return !DONE;
        }

        QueryCache queryCache = domain.getQueryCache();
        QueryCacheEntryFactory factory = getCacheObjectFactory();

        if (cache) {
            List cachedResults = queryCache.get(metadata, factory);

            // response may already be initialized by the factory above ... it is null if
            // there was a preexisting cache entry
            if (response == null) {
                response = new ListResponse(cachedResults);
            }

            if (cachedResults instanceof ListWithPrefetches) {
                this.prefetchResultsByPath = ((ListWithPrefetches) cachedResults)
                        .getPrefetchResultsByPath();
            }
        }
        else {
            // on cache-refresh request, fetch without blocking and fill the cache
            queryCache.put(metadata, (List) factory.createObject());
        }

        return DONE;
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        if (!cacheOrCacheRefresh) {
            return !DONE;
        }

        QueryCache queryCache = getQueryCache();
        QueryCacheEntryFactory factory = getCacheObjectFactory();

        if (cache) {
            List cachedResults = queryCache.get(metadata, factory);

            // response may already be initialized by the factory above ... it is null if
            // there was a preexisting cache entry
            if (response == null) {
                response = new ListResponse(cachedResults);
            }
        }
        else {
            // on cache-refresh request, fetch without blocking and fill the cache
            queryCache.put(metadata, (List) factory.createObject());
        }

        return DONE;
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        // read page 1
        assertTrue(results.get(0) instanceof ClientMtTable1);

        // now kick out the server-side list from local cache, and see if the query would
        // recover...
        QueryCache qc = serverChannel.getQueryCache();
        assertEquals(1, qc.size());
        qc.clear();
        assertEquals(0, qc.size());

        assertTrue(results.get(3) instanceof ClientMtTable1);
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

    }

    public void testAttachToRuntimeIfNeeded() {

        final DataChannel channel = mock(DataChannel.class);
        final QueryCache cache = mock(QueryCache.class);

        Module testModule = new Module() {

            public void configure(Binder binder) {
                binder.bind(DataChannel.class).toInstance(channel);
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        if (!cacheOrCacheRefresh) {
            return !DONE;
        }

        QueryCache queryCache = getQueryCache();
        QueryCacheEntryFactory factory = getCacheObjectFactory();

        if (cache) {
            List cachedResults = queryCache.get(metadata, factory);

            // response may already be initialized by the factory above ... it is null if
            // there was a preexisting cache entry
            if (response == null) {
                response = new ListResponse(cachedResults);
            }
        }
        else {
            // on cache-refresh request, fetch without blocking and fill the cache
            queryCache.put(metadata, (List) factory.createObject());
        }

        return DONE;
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        if (!cacheOrCacheRefresh) {
            return !DONE;
        }

        QueryCache queryCache = domain.getQueryCache();
        QueryCacheEntryFactory factory = getCacheObjectFactory();

        if (cache) {
            List cachedResults = queryCache.get(metadata, factory);

            // response may already be initialized by the factory above ... it is null if
            // there was a preexisting cache entry
            if (response == null) {
                response = new ListResponse(cachedResults);
            }

            if (cachedResults instanceof ListWithPrefetches) {
                this.prefetchResultsByPath = ((ListWithPrefetches) cachedResults)
                        .getPrefetchResultsByPath();
            }
        }
        else {
            // on cache-refresh request, fetch without blocking and fill the cache
            queryCache.put(metadata, (List) factory.createObject());
        }

        return DONE;
    }
View Full Code Here

Examples of org.apache.cayenne.cache.QueryCache

        if (!cacheOrCacheRefresh) {
            return !DONE;
        }

        QueryCache queryCache = domain.getQueryCache();
        QueryCacheEntryFactory factory = getCacheObjectFactory();

        if (cache) {
            List cachedResults = queryCache.get(metadata, factory);

            // response may already be initialized by the factory above ... it is null if
            // there was a preexisting cache entry
            if (response == null) {
                response = new ListResponse(cachedResults);
            }

            if (cachedResults instanceof ListWithPrefetches) {
                this.prefetchResultsByPath = ((ListWithPrefetches) cachedResults)
                        .getPrefetchResultsByPath();
            }
        }
        else {
            // on cache-refresh request, fetch without blocking and fill the cache
            queryCache.put(metadata, (List) factory.createObject());
        }

        return DONE;
    }
View Full Code Here

Examples of org.apache.openjpa.datacache.QueryCache

                releaseConn = _connRetainMode != CONN_RETAIN_ALWAYS;
                if (rollback)
                    _store.rollback();
                else {
                    // and notify the query cache.  notify in one batch to reduce synch
                    QueryCache queryCache = getConfiguration().
                    getDataCacheManagerInstance().getSystemQueryCache();
                    if (queryCache != null) {
                        Collection<Class<?>> pers = getPersistedTypes();
                        Collection<Class<?>> del = getDeletedTypes();
                        Collection<Class<?>> up = getUpdatedTypes();
                        int size = pers.size() + del.size() + up.size();
                        if (size > 0) {
                            Collection<Class<?>> types = new ArrayList<Class<?>>(size);
                            types.addAll(pers);
                            types.addAll(del);
                            types.addAll(up);
                            queryCache.onTypesChanged(new TypesChangedEvent(this, types));
                        }
                    }
                    _store.commit();
                }
            } else {
View Full Code Here

Examples of org.apache.openjpa.datacache.QueryCache

        StoreQuery sq = newStoreQuery(language);
        if (sq == null || QueryLanguages.parserForLanguage(language) == null) {
            return sq;
        }

        QueryCache queryCache = _ctx.getConfiguration().getDataCacheManagerInstance().getSystemQueryCache();
        if (queryCache == null) {
            return sq;
        }
       
        return new QueryCacheStoreQuery(sq, queryCache);
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.