T - type of object cachedpublic abstract class CachedObject<T> extends Object implements CacheManager.CachedData
| Modifier and Type | Field and Description |
|---|---|
protected long |
expiration |
protected long |
lastUsage |
protected T |
object |
protected int |
usage |
protected ArrayList<Object> |
users |
| Constructor and Description |
|---|
CachedObject(T object,
long expiration)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
cachedDataCurrentUsage()
Return the number of clients currently using this data.
|
long |
cachedDataLastUsage()
Return the timestamp of the last time this data has been used.
|
void |
close()
Close this cached data, and release any resource of it.
|
protected abstract void |
closeCachedObject(T object) |
T |
get() |
long |
getExpiration() |
long |
getLastUsage() |
int |
getUsage() |
void |
release(Object user)
Remove the given object as user of this cached data.
|
void |
use(Object user)
Add the given object as user of this cached data.
|
protected T object
protected int usage
protected long expiration
protected long lastUsage
public CachedObject(T object, long expiration)
public T get()
public void use(Object user)
public void release(Object user)
public int getUsage()
public long getLastUsage()
public long getExpiration()
public void close()
protected abstract void closeCachedObject(T object)
public int cachedDataCurrentUsage()
CacheManager.CachedDatacachedDataCurrentUsage in interface CacheManager.CachedDatapublic long cachedDataLastUsage()
CacheManager.CachedDatacachedDataLastUsage in interface CacheManager.CachedDataCopyright © 2019. All rights reserved.