Interface DIHCache
-
- All Known Implementing Classes:
SortedMapBackedCache
public interface DIHCache extends Iterable<Map<String,Object>>
A cache that allows a DIH entity's data to persist locally prior being joined to other data and/or indexed.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(Map<String,Object> rec)
Adds a document.void
close()
Releases resources used by this cache, if possible.void
delete(Object key)
Delete all documents associated with the given keyvoid
deleteAll()
Delete all data from the cache,leaving the empty cache intact.void
destroy()
Closes the cache, if open.void
flush()
Persists any pending data to the cacheIterator<Map<String,Object>>
iterator()
Returns an iterator, allowing callers to iterate through the entire cache in key, then insertion, order.Iterator<Map<String,Object>>
iterator(Object key)
Returns an iterator, allowing callers to iterate through all documents that match the given key in insertion order.void
open(Context context)
Opens the cache using the specified properties.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
open
void open(Context context)
Opens the cache using the specified properties. The
Context
includes any parameters needed by the cache impl. This must be called before any read/write operations are permitted.
-
close
void close()
Releases resources used by this cache, if possible. The cache is flushed but not destroyed.
-
flush
void flush()
Persists any pending data to the cache
-
destroy
void destroy()
Closes the cache, if open. Then removes all data, possibly removing the cache entirely from persistent storage.
-
add
void add(Map<String,Object> rec)
Adds a document. If a document already exists with the same key, both documents will exist in the cache, as the cache allows duplicate keys. To update a key's documents, first call delete(Object key).
-
iterator
Iterator<Map<String,Object>> iterator()
Returns an iterator, allowing callers to iterate through the entire cache in key, then insertion, order.
-
iterator
Iterator<Map<String,Object>> iterator(Object key)
Returns an iterator, allowing callers to iterate through all documents that match the given key in insertion order.
-
delete
void delete(Object key)
Delete all documents associated with the given key
-
deleteAll
void deleteAll()
Delete all data from the cache,leaving the empty cache intact.
-
-