V - The object it is cachingpublic class Cache<V> extends Object
An internal cached element
An internal cached object which hits the database only when it needs to.
This is used to cache the components of ontological concepts. i.e. the fields of Type,
RelationshipType, and Role.
| Constructor and Description |
|---|
Cache(Cacheable<V> cacheable,
java.util.function.Supplier<V> databaseReader) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the cache.
|
void |
flush()
Takes the current value in the transaction cache if it is present and puts it in the valueGlobal reference so
that it can be accessed via all transactions.
|
V |
get()
Retrieves the object in the cache.
|
void |
ifPresent(java.util.function.Consumer<V> modifier)
Mutates the cached value if something is cached.
|
void |
set(V value)
Explicitly set the cache to a provided value
|
public Cache(Cacheable<V> cacheable, java.util.function.Supplier<V> databaseReader)
@Nullable public V get()
public void clear()
public void set(@Nullable V value)
value - the value to be cachedpublic void ifPresent(java.util.function.Consumer<V> modifier)
modifier - the mutator function.public void flush()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.