| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
cacheHits
Maintain the number of cache hits and misses.
|
protected long |
cacheMisses
Maintain the number of cache hits and misses.
|
protected int |
cacheSize
Maintains the current size of the cache in bytes.
|
protected Connection |
conn |
static String |
DELETE_CACHE_BYNAME_SQL |
static String |
DELETE_CACHE_BYTIME_SQL |
static String |
DELETE_CACHE_SQL |
static String |
INSERT_CACHE_SQL |
protected boolean |
isStopPutWhenFull |
static String |
LOAD_ALL_CACHE_SQL |
static String |
LOAD_CACHE_BYNAME_ORDERED_SQL |
static String |
LOAD_CACHE_BYNAME_SQL |
static String |
LOAD_CACHE_COUNT_SQL |
static String |
LOAD_CACHE_SQL |
protected int |
maxCacheSize
Maximum size in bytes that the cache can grow to.
|
protected long |
maxLifetime
Maximum length of time objects can exist in cache before expiring.
|
protected String |
name
The name of the cache.
|
static String |
TABLE_NAME |
| 构造器和说明 |
|---|
HsqlDbCache(String name,
int maxSize,
long maxLifetime,
HsqlDbServer db)
Create a new cache and specify the maximum size of for the cache in
bytes, and the maximum lifetime of objects.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected int |
calculateSize(Object object)
Returns the size of an object in bytes.
|
void |
clear()
Removes all cached datas from this cache (optional operation).
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
protected void |
cullCache()
Removes objects from cache if the cache is too full.
|
protected void |
deleteExpiredEntries()
Clears all entries out of cache where the entries are older than the
maximum defined age.
|
Set |
entrySet() |
Object |
get(Object key) |
long |
getCacheHits()
Returns the number of cache hits.
|
long |
getCacheMisses()
Returns the number of cache misses.
|
int |
getCacheSize()
Returns the size of the cache contents in bytes.
|
int |
getMaxCacheSize()
Returns the maximum size of the cache in bytes.
|
long |
getMaxLifetime()
Returns the maximum number of milleseconds that any object can live
in cache.
|
String |
getName()
Implementation methods of Cache interface
|
boolean |
isEmpty() |
Set |
keySet() |
Object |
put(Object key,
Object value) |
void |
putAll(Map map) |
Object |
remove(Object key) |
void |
setMaxCacheSize(int maxCacheSize)
Sets the maximum size of the cache in bytes.
|
void |
setMaxLifetime(long maxLifetime)
Sets the maximum number of milleseconds that any object can live
in cache.
|
void |
setStopPutWhenFull(boolean flag)
set the flag whether stop putting into cache when it was full or not.
|
int |
size() |
Collection |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllprotected Connection conn
public static final String TABLE_NAME
public static final String DELETE_CACHE_SQL
public static final String DELETE_CACHE_BYTIME_SQL
public static final String DELETE_CACHE_BYNAME_SQL
public static final String INSERT_CACHE_SQL
public static final String LOAD_ALL_CACHE_SQL
public static final String LOAD_CACHE_SQL
public static final String LOAD_CACHE_BYNAME_SQL
public static final String LOAD_CACHE_COUNT_SQL
public static final String LOAD_CACHE_BYNAME_ORDERED_SQL
protected int maxCacheSize
protected int cacheSize
protected long maxLifetime
protected long cacheHits
Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
protected long cacheMisses
Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
protected String name
protected boolean isStopPutWhenFull
public HsqlDbCache(String name, int maxSize, long maxLifetime, HsqlDbServer db)
name - a name for the cache.maxSize - the maximum size of the cache in bytes. -1 means the cache
has no max size.maxLifetime - the maximum amount of time objects can exist in
cache before being deleted. -1 means objects never expire.public void clear()
Cachepublic Collection values()
public boolean containsKey(Object key)
containsKey 在接口中 Mappublic boolean containsValue(Object value)
containsValue 在接口中 Mappublic String getName()
public long getCacheHits()
CacheKeeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
getCacheHits 在接口中 Cachepublic long getCacheMisses()
CacheKeeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
getCacheMisses 在接口中 Cachepublic int getCacheSize()
CachegetCacheSize 在接口中 Cachepublic int getMaxCacheSize()
CachegetMaxCacheSize 在接口中 Cachepublic void setMaxCacheSize(int maxCacheSize)
CachesetMaxCacheSize 在接口中 CachemaxCacheSize - the maximum size of the cache in bytes.public long getMaxLifetime()
CachegetMaxLifetime 在接口中 Cachepublic void setMaxLifetime(long maxLifetime)
CachesetMaxLifetime 在接口中 CachemaxLifetime - the maximum number of milleseconds before objects are expired.protected int calculateSize(Object object)
protected void deleteExpiredEntries()
protected void cullCache()
public void setStopPutWhenFull(boolean flag)
CachesetStopPutWhenFull 在接口中 CacheCopyright © 2023 onecode. All rights reserved.