public static interface ICachingDictionary.IItemCache extends IHasLifecycle
IHasLifecycle.LifecycleState, IHasLifecycle.ObjectClosedException, IHasLifecycle.ObjectOpenException| Modifier and Type | Method and Description |
|---|---|
void |
cacheItem(IItem<?> item)
Caches the specified item, if this cache is enabled.
|
void |
cacheSenseEntry(ISenseEntry entry)
Caches the specified entry.
|
void |
cacheWordByKey(IWord word)
Caches the specified word, indexed by its sense key.
|
void |
clear()
Removes all entries from the cache.
|
int |
getMaximumCapacity()
Returns the maximum capacity of this cache.
|
boolean |
isEnabled()
Returns
true if this cache is enabled;
false otherwise. |
<T extends IItem<D>,D extends IItemID<T>> |
retrieveItem(D id)
Retrieves the item identified by the specified id.
|
ISenseEntry |
retrieveSenseEntry(ISenseKey key)
Retrieves the sense entry identified by the specified sense key.
|
IWord |
retrieveWord(ISenseKey key)
Retrieves the word identified by the specified sense key.
|
void |
setEnabled(boolean isEnabled)
Enables (
true) or disables (false) caching. |
void |
setMaximumCapacity(int capacity)
Sets the maximum capacity of the cache
|
int |
size()
Returns the number of items in the cache.
|
isOpen, openboolean isEnabled()
true if this cache is enabled;
false otherwise. If a cache is enabled, it will cache an
item passed to its cache methods.true if this cache is enabled;
false otherwisevoid setEnabled(boolean isEnabled)
true) or disables (false) caching.isEnabled - if true, caching is enabled; if
false, caching is disabled.void setMaximumCapacity(int capacity)
capacity - the maximum capacityint getMaximumCapacity()
int size()
void cacheItem(IItem<?> item)
item - the item to be cached; may not be nullNullPointerException - if the specified item is nullvoid cacheWordByKey(IWord word)
word - the word to be cached; may not be nullNullPointerException - if the specified word is nullvoid cacheSenseEntry(ISenseEntry entry)
entry - the entry to be cached; may not be nullNullPointerException - if the specified entry is null<T extends IItem<D>,D extends IItemID<T>> T retrieveItem(D id)
T - the type of the itemD - the type of the item idid - the id for the requested itemnull if not
present in the cacheNullPointerException - if the specified id is nullIWord retrieveWord(ISenseKey key)
key - the sense key for the requested wordnull if not
present in the cacheNullPointerException - if the specified key is nullISenseEntry retrieveSenseEntry(ISenseKey key)
key - the sense key for the requested sense entrynull if not
present in the cacheNullPointerException - if the specified key is nullvoid clear()
Copyright © 2018. All rights reserved.