Deprecated
as a consequence of CacheConcurrencyStrategy being deprecated. See corresponding docs for further information.
for a faster algorithm, CacheConcurrencyStrategy
| Modifier and Type | Class and Description |
|---|---|
| public static class | ReadWriteCache.Item
An item of cached data, timestamped with the time it was cached,. |
| public static class | ReadWriteCache.Lock
A soft lock which supports concurrent locking, timestamped with the time it was released |
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| private Cache | |
| private static final Logger | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized boolean | afterInsert(Object key, Object value, Object version)
Implements org. |
| public synchronized boolean | afterUpdate(Object key, Object value, Object version, SoftLock clientLock)
Implements org. |
| public void | clear()
Implements org. |
| private void | |
| public void | |
| public void | |
| public synchronized Object | get(Object key, long
a timestamp prior to the transaction start time txTimestamp)Implements org. |
| public Cache | getCache()
Implements org.
Deprecated
as a consequence of
Get the wrapped cache implementation
Cache being deprecated.
|
| public String | getRegionName()
Implements org. |
| pack-priv void | |
| public boolean | insert(Object key, Object value, Object currentVersion)
Implements org. |
| private boolean | isUnlockable(SoftLock clientLock, ReadWriteCache.
Is the client's lock commensurate with the item in the cache? |
| public synchronized SoftLock | lock(Object key, Object version)
Implements org. |
| private int | |
| public synchronized boolean | put(Object key, Object value, long
a timestamp prior to the transaction start time txTimestamp, Object the item version number version, Comparator<T> a comparator used to compare version numbers versionComparator, boolean indicates that the cache should avoid a put is the item is already cached minimalPut)Implements org. |
| public synchronized void | release(Object key, SoftLock clientLock)
Implements org. |
| public void | remove(Object key)
Implements org. |
| public void | setCache(Cache cache)
Implements org.
Deprecated
as a consequence of
Set the underlying cache implementation.
Cache being deprecated.
|
| public String | |
| public boolean |
| cache | back to summary |
|---|---|
| private Cache cache
Deprecated as a consequence of | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| nextLockId | back to summary |
|---|---|
| private int nextLockId | |
| ReadWriteCache | back to summary |
|---|---|
| public ReadWriteCache() | |
| afterInsert | back to summary |
|---|---|
| public synchronized boolean afterInsert(Object key, Object value, Object version) throws CacheException Implements org. Add the new item to the cache, checking that no other transaction has accessed the item. | |
| afterUpdate | back to summary |
|---|---|
| public synchronized boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock) throws CacheException Implements org. Re-cache the updated state, if and only if there there are no other concurrent soft locks. Release our lock. | |
| clear | back to summary |
|---|---|
| public void clear() throws CacheException Implements org. Doc from org. Evict all items from the cache immediately. | |
| decrementLock | back to summary |
|---|---|
| private void decrementLock(Object key, ReadWriteCache. decrement a lock and put it back in the cache | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. Doc from org. Clean up all resources. | |
| evict | back to summary |
|---|---|
| public void evict(Object key) throws CacheException Implements org. Do nothing. | |
| get | back to summary |
|---|---|
| public synchronized Object get(Object key, long txTimestamp) throws CacheException Implements org. Do not return an item whose timestamp is later than the current
transaction timestamp. (Otherwise we might compromise repeatable
read unnecessarily.) Do not return an item which is soft-locked.
Always go straight to the database instead.
| |
| getCache | back to summary |
|---|---|
| public Cache getCache() Implements org. Doc from org. Deprecated as a consequence of Get the wrapped cache implementation | |
| getRegionName | back to summary |
|---|---|
| public String getRegionName() Implements org. Doc from org. Get the cache region name | |
| handleLockExpiry | back to summary |
|---|---|
| pack-priv void handleLockExpiry(Object key) throws CacheException | |
| insert | back to summary |
|---|---|
| public boolean insert(Object key, Object value, Object currentVersion) Implements org. Do nothing. | |
| isUnlockable | back to summary |
|---|---|
| private boolean isUnlockable(SoftLock clientLock, ReadWriteCache. Is the client's lock commensurate with the item in the cache? If it is not, we know that the cache expired the original lock. | |
| lock | back to summary |
|---|---|
| public synchronized SoftLock lock(Object key, Object version) throws CacheException Implements org. Stop any other transactions reading or writing this item to/from the cache. Send them straight to the database instead. (The lock does time out eventually.) This implementation tracks concurrent locks of transactions which simultaneously attempt to write to an item. | |
| nextLockId | back to summary |
|---|---|
| private int nextLockId() Generate an id for a new lock. Uniqueness per cache instance is very desirable but not absolutely critical. Must be called from one of the synchronized methods of this class. | |
| put | back to summary |
|---|---|
| public synchronized boolean put(Object key, Object value, long txTimestamp, Object version, Comparator<T> versionComparator, boolean minimalPut) throws CacheException Implements org. Do not add an item to the cache unless the current transaction timestamp is later than the timestamp at which the item was invalidated. (Otherwise, a stale item might be re-added if the database is operating in repeatable read isolation mode.) For versioned data, don't add the item unless it is the later version.
| |
| release | back to summary |
|---|---|
| public synchronized void release(Object key, SoftLock clientLock) throws CacheException Implements org. Release the soft lock on the item. Other transactions may now re-cache the item (assuming that no other transaction holds a simultaneous lock). | |
| remove | back to summary |
|---|---|
| public void remove(Object key) throws CacheException Implements org. Doc from org. Evict an item from the cache immediately (without regard for transaction isolation). | |
| setCache | back to summary |
|---|---|
| public void setCache(Cache cache) Implements org. Doc from org. Deprecated as a consequence of Set the underlying cache implementation. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |
| update | back to summary |
|---|---|
| public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) Implements org. Do nothing. | |
ReadWriteCache
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final Object | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public Object | |
| public boolean | isGettable(long txTimestamp)
Implements org. |
| public boolean | |
| public boolean | isPuttable(long txTimestamp, Object newVersion, Comparator<T> comparator)
Implements org. |
| public ReadWriteCache. | lock(long timeout, int id)
Implements org. |
| public String |
| freshTimestamp | back to summary |
|---|---|
| private final long freshTimestamp | |
| value | back to summary |
|---|---|
| private final Object value | |
| version | back to summary |
|---|---|
| private final Object version | |
| Item | back to summary |
|---|---|
| public Item(Object value, Object version, long currentTimestamp) | |
| getFreshTimestamp | back to summary |
|---|---|
| public long getFreshTimestamp() The timestamp on the cached data | |
| getValue | back to summary |
|---|---|
| public Object getValue() The actual cached data | |
| isGettable | back to summary |
|---|---|
| public boolean isGettable(long txTimestamp) Implements org. Is this item visible to the timestamped transaction? | |
| isLock | back to summary |
|---|---|
| public boolean isLock() Implements org. Not a lock! | |
| isPuttable | back to summary |
|---|---|
| public boolean isPuttable(long txTimestamp, Object newVersion, Comparator<T> comparator) Implements org. Don't overwite already cached items | |
| lock | back to summary |
|---|---|
| public ReadWriteCache. Implements org. Lock the item | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final int | |
| private int | |
| private long | |
| private long | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public long | |
| public boolean | isGettable(long txTimestamp)
Implements org. |
| public boolean | |
| public boolean | isPuttable(long txTimestamp, Object newVersion, Comparator<T> comparator)
Implements org. |
| public ReadWriteCache. | lock(long timeout, int id)
Implements org. |
| public String | |
| public void | |
| public boolean |
| concurrentLock | back to summary |
|---|---|
| private boolean concurrentLock | |
| id | back to summary |
|---|---|
| private final int id | |
| multiplicity | back to summary |
|---|---|
| private int multiplicity | |
| timeout | back to summary |
|---|---|
| private long timeout | |
| unlockTimestamp | back to summary |
|---|---|
| private long unlockTimestamp | |
| version | back to summary |
|---|---|
| private final Object version | |
| Lock | back to summary |
|---|---|
| public Lock(long timeout, int id, Object version) | |
| getId | back to summary |
|---|---|
| public int getId() | |
| getUnlockTimestamp | back to summary |
|---|---|
| public long getUnlockTimestamp() | |
| isGettable | back to summary |
|---|---|
| public boolean isGettable(long txTimestamp) Implements org. locks are not returned to the client! | |
| isLock | back to summary |
|---|---|
| public boolean isLock() Implements org. Yes, this is a lock | |
| isPuttable | back to summary |
|---|---|
| public boolean isPuttable(long txTimestamp, Object newVersion, Comparator<T> comparator) Implements org. Can the timestamped transaction re-cache this locked item now? | |
| lock | back to summary |
|---|---|
| public ReadWriteCache. Implements org. Increment the lock, setting the new lock timeout | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |
| unlock | back to summary |
|---|---|
| public void unlock(long currentTimestamp) Decrement the lock, setting the unlock timestamp if now unlocked | |
| wasLockedConcurrently | back to summary |
|---|---|
| public boolean wasLockedConcurrently() Was this lock held concurrently by multiple transactions? | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public boolean | |
| public boolean | |
| public ReadWriteCache. |
| isGettable | back to summary |
|---|---|
| public boolean isGettable(long txTimestamp) | |
| isLock | back to summary |
|---|---|
| public boolean isLock() | |
| isPuttable | back to summary |
|---|---|
| public boolean isPuttable(long txTimestamp, Object newVersion, Comparator<T> comparator) | |
| lock | back to summary |
|---|---|
| public ReadWriteCache. | |