Package org.apache.ignite.cache
Interface Cache
public interface Cache
A cache is a data structure backed by in-memory distributed table which is used to speed up the access to some external "slow" resource.
The external resource abstraction is defined by CacheStore
interface.
The cache can be viewed as strongly typed key-value or tuple map.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionkeyValueView
(CacheStoreFactory store) Creates a key-value view of a cache using tuple mapping.<K,
V> KeyValueView<K, V> keyValueView
(CacheStoreFactory store, Mapper<K> keyMapper, Mapper<V> valMapper) Creates a key-value view of a cache using object mapping.loadAsync
(CacheStoreFactory fac, @Nullable BiPredicate<Tuple, Tuple> filter, @Nullable Object... args) Loads a GridGain cache from cache store.<K,
V> CompletableFuture<Void> loadAsync
(CacheStoreFactory fac, Mapper<K> keyMapper, Mapper<V> valMapper, @Nullable BiPredicate<K, V> filter, @Nullable Object... args) Loads a GridGain cache from cache store.default String
name()
Gets the canonical name of the cache ([schema_name].[cache_name]) with SQL-parser style quotation.Gets the qualified name of the cache.
-
Method Details
-
name
Gets the canonical name of the cache ([schema_name].[cache_name]) with SQL-parser style quotation.E.g. "PUBLIC.CACHE0" - for CACHE0 cache in PUBLIC schema (both names are case insensitive), "\"MySchema\".\"Cache0\"" - for Cache0 cache in MySchema schema (both names are case sensitive), etc.
- Returns:
- Canonical cache name.
-
qualifiedName
QualifiedName qualifiedName()Gets the qualified name of the cache.- Returns:
- Qualified name of the cache.
-
keyValueView
<K,V> KeyValueView<K,V> keyValueView(CacheStoreFactory store, Mapper<K> keyMapper, Mapper<V> valMapper) Creates a key-value view of a cache using object mapping.- Type Parameters:
K
- Key type.V
- Value type.- Parameters:
store
- Cache store.keyMapper
- Key class mapper.valMapper
- Value class mapper.- Returns:
- Cache key-value view.
-
keyValueView
Creates a key-value view of a cache using tuple mapping.- Parameters:
store
- Cache store.- Returns:
- Cache key-value view.
-
loadAsync
<K,V> CompletableFuture<Void> loadAsync(CacheStoreFactory fac, Mapper<K> keyMapper, Mapper<V> valMapper, @Nullable @Nullable BiPredicate<K, V> filter, @Nullable @Nullable Object... args) Loads a GridGain cache from cache store.Useful for preloading cache with the data to avoid loading on read through.
- Type Parameters:
K
- Key class.V
- Value class.- Parameters:
fac
- Cache store factory.keyMapper
- Key class mapper.valMapper
- Value class mapper.filter
- Entry filter. Returningfalse
from filter skips the entry on preloading.args
- Optional arguments.- Returns:
- The future.
-
loadAsync
CompletableFuture<Void> loadAsync(CacheStoreFactory fac, @Nullable @Nullable BiPredicate<Tuple, Tuple> filter, @Nullable @Nullable Object... args) Loads a GridGain cache from cache store.Useful for preloading cache with the data to avoid loading on read through.
- Parameters:
fac
- Cache store factory.filter
- Entry filter.args
- Optional arguments.- Returns:
- The future.
-