| Modifier and Type | Field and Description |
|---|---|
| private final boolean | fifo
Use First-In-First-Out (don't move recently used items to the front of the queue). |
| private final CacheObject | |
| private final int | len
The number of cache buckets. |
| private final int | |
| private long | maxMemory
The maximum memory, in words (4 bytes each). |
| private long | memory
The current memory used in this cache, in words (4 bytes each). |
| private int | |
| pack-priv static final String | |
| private CacheObject[] | |
| private final CacheWriter |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| public CacheObject | find(int
the unique key of the element pos)Implements org. Get an element from the cache if it is available. |
| public CacheObject | get(int
the unique key of the element pos)Implements org. Get an element in the cache if it is available. |
| public ArrayList | getAllChanged()
Implements org. Get all objects in the cache that have been changed. |
| public static Cache | Returns: the cache objectthe cache writer writer, String the cache type cacheType, int the size cacheSize)Create a cache of the given type and size. |
| public int | |
| public int | |
| public void | |
| public boolean | remove(int
the unique key of the element pos)Implements org. Remove an object from the cache. |
| private void | |
| private void | |
| private void | |
| public void | setMaxMemory(int
the maximum size in KB maxKb)Implements org. Set the maximum memory to be used by this cache. |
| public CacheObject | update(int
the unique key of the element pos, CacheObject the element rec)Implements org. Update an element in the cache. |
| fifo | back to summary |
|---|---|
| private final boolean fifo Use First-In-First-Out (don't move recently used items to the front of the queue). | |
| head | back to summary |
|---|---|
| private final CacheObject head | |
| len | back to summary |
|---|---|
| private final int len The number of cache buckets. | |
| mask | back to summary |
|---|---|
| private final int mask | |
| maxMemory | back to summary |
|---|---|
| private long maxMemory The maximum memory, in words (4 bytes each). | |
| memory | back to summary |
|---|---|
| private long memory The current memory used in this cache, in words (4 bytes each). | |
| recordCount | back to summary |
|---|---|
| private int recordCount | |
| TYPE_NAME | back to summary |
|---|---|
| pack-priv static final String TYPE_NAME | |
| values | back to summary |
|---|---|
| private CacheObject[] values | |
| writer | back to summary |
|---|---|
| private final CacheWriter writer | |
| CacheLRU | back to summary |
|---|---|
| pack-priv CacheLRU(CacheWriter writer, int maxMemoryKb, boolean fifo) | |
| addToFront | back to summary |
|---|---|
| private void addToFront(CacheObject rec) | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Doc from org. Clear the cache.
| |
| find | back to summary |
|---|---|
| public CacheObject find(int pos) Implements org. Doc from org. Get an element from the cache if it is available. This will not move the item to the front of the list.
| |
| get | back to summary |
|---|---|
| public CacheObject get(int pos) Implements org. Doc from org. Get an element in the cache if it is available. This will move the item to the front of the list.
| |
| getAllChanged | back to summary |
|---|---|
| public ArrayList Implements org. Doc from org. Get all objects in the cache that have been changed.
| |
| getCache | back to summary |
|---|---|
| public static Cache getCache(CacheWriter writer, String cacheType, int cacheSize) Create a cache of the given type and size.
| |
| getMaxMemory | back to summary |
|---|---|
| public int getMaxMemory() Implements org. Doc from org. Get the maximum memory to be used.
| |
| getMemory | back to summary |
|---|---|
| public int getMemory() Implements org. Doc from org. Get the used size in KB.
| |
| put | back to summary |
|---|---|
| public void put(CacheObject rec) Implements org. Doc from org. Add an element to the cache. Other items may fall out of the cache because of this. It is not allowed to add the same record twice.
| |
| remove | back to summary |
|---|---|
| public boolean remove(int pos) Implements org. Doc from org. Remove an object from the cache.
| |
| removeFromLinkedList | back to summary |
|---|---|
| private void removeFromLinkedList(CacheObject rec) | |
| removeOld | back to summary |
|---|---|
| private void removeOld() | |
| removeOldIfRequired | back to summary |
|---|---|
| private void removeOldIfRequired() | |
| setMaxMemory | back to summary |
|---|---|
| public void setMaxMemory(int maxKb) Implements org. Doc from org. Set the maximum memory to be used by this cache.
| |
| update | back to summary |
|---|---|
| public CacheObject update(int pos, CacheObject rec) Implements org. Doc from org. Update an element in the cache. This will move the item to the front of the list.
| |