Package com.landawn.abacus.cache
Interface Cache<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractCache,CaffeineCache,DistributedCache,Ehcache,LocalCache,OffHeapCache
- Since:
- 0.8
- Author:
- Haiyang Li
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final long -
Method Summary
Modifier and TypeMethodDescriptioncom.landawn.abacus.util.ContinuableFuture<Boolean>Async contains key.com.landawn.abacus.util.ContinuableFuture<com.landawn.abacus.util.u.Optional<V>>com.landawn.abacus.util.ContinuableFuture<V>com.landawn.abacus.util.ContinuableFuture<Boolean>com.landawn.abacus.util.ContinuableFuture<Boolean>com.landawn.abacus.util.ContinuableFuture<Void>asyncRemove(K k) voidclear()Remove all cached entities from cache pool.voidclose()release the resource token by this cache.booleancontainsKey(K k) com.landawn.abacus.util.u.Optional<V>Gets the properties.<T> TgetProperty(String propName) Gets the property.Gets the t.booleanisClosed()keySet()booleanbooleanvoid<T> TremoveProperty(String propName) Returns value of the property which is to be removed,nullif it doesn't exist.<T> TsetProperty(String propName, Object propValue) Returns the old value associated with the property by thepropName,nullif it doesn't exist.intsize()
-
Field Details
-
DEFAULT_LIVE_TIME
static final long DEFAULT_LIVE_TIME- See Also:
-
DEFAULT_MAX_IDLE_TIME
static final long DEFAULT_MAX_IDLE_TIME- See Also:
-
-
Method Details
-
get
- Parameters:
k-- Returns:
- V
-
gett
Gets the t.- Parameters:
k-- Returns:
- V
-
put
- Parameters:
k-v-- Returns:
- true, if successful
-
put
- Parameters:
k-v-liveTime- unit is millisecondsmaxIdleTime- unit is milliseconds- Returns:
- true, if successful
-
remove
- Parameters:
k-
-
containsKey
- Parameters:
k-- Returns:
- boolean
-
asyncGet
- Parameters:
k-- Returns:
-
asyncGett
- Parameters:
k-- Returns:
-
asyncPut
- Parameters:
k-v-- Returns:
-
asyncPut
com.landawn.abacus.util.ContinuableFuture<Boolean> asyncPut(K k, V v, long liveTime, long maxIdleTime) - Parameters:
k-v-liveTime-maxIdleTime-- Returns:
-
asyncRemove
- Parameters:
k-- Returns:
-
asyncContainsKey
Async contains key.- Parameters:
k-- Returns:
-
keySet
- Returns:
- Set
-
size
int size()- Returns:
-
clear
void clear()Remove all cached entities from cache pool. -
close
void close()release the resource token by this cache.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
isClosed
boolean isClosed()- Returns:
- true, if is closed
-
getProperties
Gets the properties.- Returns:
-
getProperty
Gets the property.- Type Parameters:
T-- Parameters:
propName-- Returns:
-
setProperty
Returns the old value associated with the property by thepropName,nullif it doesn't exist.- Type Parameters:
T-- Parameters:
propName-propValue-- Returns:
-
removeProperty
Returns value of the property which is to be removed,nullif it doesn't exist.- Type Parameters:
T-- Parameters:
propName-- Returns:
-