All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.grakn.kb.internal.cache.Cacheable Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
/*
 * GRAKN.AI - THE KNOWLEDGE GRAPH
 * Copyright (C) 2018 Grakn Labs Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package ai.grakn.kb.internal.cache;


import ai.grakn.concept.Concept;
import ai.grakn.concept.ConceptId;
import ai.grakn.concept.Label;
import ai.grakn.concept.LabelId;
import ai.grakn.kb.internal.structure.Shard;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.UnaryOperator;

/**
 * 

* Contains the functionality needed to add an {@link Object} to {@link Cache} *

* *

* This is used to wrap functionality needed by {@link Cache}. * Specifically it is used to ensure that when flushing {@link Cache#valueGlobal} into {@link Cache#valueTx} * no cache leaks can occur. For example this is needed when caching {@link java.util.Collection} *

* * @author fppt * * @param */ public class Cacheable { private final UnaryOperator copier; private Cacheable(UnaryOperator copier){ this.copier = copier; } // Constructors for supported cache-able items public static Cacheable conceptId(){ return new Cacheable<>((o) -> o); } public static Cacheable number(){ return new Cacheable<>((o) -> o); } public static Cacheable




© 2015 - 2025 Weber Informatics LLC | Privacy Policy