Github user kchilton2 commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/251#discussion_r153274878
  
    --- Diff: 
extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/query/FluoQueryMetadataCache.java
 ---
    @@ -0,0 +1,247 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */package org.apache.rya.indexing.pcj.fluo.app.query;
    +
    +import static com.google.common.base.Preconditions.checkArgument;
    +
    +import java.util.concurrent.Callable;
    +
    +import org.apache.fluo.api.client.SnapshotBase;
    +import org.apache.fluo.api.data.Bytes;
    +import org.apache.fluo.api.data.Column;
    +import org.apache.rya.indexing.pcj.fluo.app.NodeType;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.google.common.base.Optional;
    +import com.google.common.cache.Cache;
    +import com.google.common.cache.CacheBuilder;
    +
    +/**
    + * Wrapper for {@link FluoQueryMetadataDAO} that caches any metadata that 
has been retrieved from Fluo. This class first
    + * checks the cache to see if the metadata is present before delegating to 
the underlying DAO method to retrieve the
    + * data.
    + *
    + */
    +public class FluoQueryMetadataCache extends FluoQueryMetadataDAO {
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(FluoQueryMetadataCache.class);
    +    private final FluoQueryMetadataDAO dao;
    +    private final Cache<String, CommonNodeMetadata> 
commonNodeMetadataCache;
    +    private final Cache<String, Bytes> metadataCache;
    +    private int capacity;
    +    private int concurrencyLevel;
    +
    +    /**
    +     * Creates a FluoQueryMetadataCache with the specified capacity. Old, 
unused results are evicted as necessary.
    +     *
    +     * @param capacity - max size of the cache
    +     */
    +    public FluoQueryMetadataCache(FluoQueryMetadataDAO dao, int capacity, 
int concurrencyLevel) {
    +        this.dao = dao;
    --- End diff --
    
    null check


---

Reply via email to