Package com.thinkaurelius.titan.graphdb.database

Examples of com.thinkaurelius.titan.graphdb.database.RelationQueryCache$CacheEntry


    public SimpleVertexQueryProcessor(InternalVertex vertex, TitanKey key) {
        this(vertex);
        assert key==null || !((InternalType)key).isHidden();
        assert key==null || !((InternalType)key).isStatic(Direction.OUT);
        RelationQueryCache cache = tx.getGraph().getRelationCache();
        filterHiddenProperties = key==null;
        if (key==null || tx.getConfiguration().hasPropertyPrefetching()) {
            this.key = key;
            sliceQuery = cache.getQuery(RelationType.PROPERTY);
        } else {
            sliceQuery = cache.getQuery((InternalType)key,Direction.OUT);
        }
    }
View Full Code Here


    public SimpleVertexQueryProcessor(InternalVertex vertex, Direction dir, TitanLabel label,
                                      EdgeSerializer.TypedInterval[] sortKeyConstraints, int limit) {
        this(vertex);
        Preconditions.checkNotNull(dir);
        RelationQueryCache cache = tx.getGraph().getRelationCache();
        if (label==null) {
            assert sortKeyConstraints==null;
            sliceQuery = cache.getQuery(RelationType.EDGE);
            filterDirection = dir==Direction.BOTH?null:dir;
        } else {
            if (AbstractVertexCentricQueryBuilder.hasSortKeyConstraints(sortKeyConstraints)) {
                sliceQuery = edgeSerializer.getQuery((InternalType)label,dir,sortKeyConstraints,null);
            } else {
                sliceQuery = cache.getQuery((InternalType)label,dir);
            }
            filterDirection = null;
        }

        this.limit = limit;
View Full Code Here

*/
public class LeastRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (lruCacheEntry == null) {
                lruCacheEntry = cacheEntry;
            } else if (lruCacheEntry.getLastAccessed() > cacheEntry.getLastAccessed()) {
                lruCacheEntry = cacheEntry;
            }
        }
        if (lruCacheEntry != null) {
            cache.evict(lruCacheEntry.getKey());
View Full Code Here

*/
public class MostRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry mruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (mruCacheEntry == null) {
                mruCacheEntry = cacheEntry;
            } else if (mruCacheEntry.getLastAccessed() < cacheEntry.getLastAccessed()) {
                mruCacheEntry = cacheEntry;
            }
        }
        if (mruCacheEntry != null) {
            cache.evict(mruCacheEntry.getKey());
View Full Code Here

public class RandomEvictionAlgorithm implements EvictionAlgorithm {
    private static Random random = new Random();

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        Collection all = cache.getAll();
        int evictionIndex = random.nextInt(all.size());
        int index = 0;

        for (Object anAll : all) {
            CacheEntry cacheEntry = (CacheEntry) anAll;
            if (index == evictionIndex) {
                lruCacheEntry = cacheEntry;
                break;
            }
            index++;
View Full Code Here

TOP

Related Classes of com.thinkaurelius.titan.graphdb.database.RelationQueryCache$CacheEntry

Copyright © 2018 www.massapicom. 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.