Package com.clickhouse.data
Interface ClickHouseCache<K,V>
public interface ClickHouseCache<K,V>
Wrapper interface depicts essential methods required by a client-side cache.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> ClickHouseCache<K, V> Creates a cache with specific capacity and load function.Gets value from cache if it exists.<T> TGets inner cache object to gain more access.
-
Field Details
-
DEFAULT_CACHE_SIZE
static final int DEFAULT_CACHE_SIZEDefault cache size.- See Also:
-
-
Method Details
-
create
Creates a cache with specific capacity and load function.- Type Parameters:
K- type of keyV- type of value- Parameters:
capacity- capacity of the cache, zero or negative number will be treated asDEFAULT_CACHE_SIZEexpireSeconds- seconds to expire after accessloadFunc- non-null load function- Returns:
- cache
-
get
Gets value from cache if it exists.- Parameters:
key- key, in genernal should NOT be null- Returns:
- non-null value in general
-
unwrap
Gets inner cache object to gain more access.- Type Parameters:
T- type of the cache- Parameters:
clazz- non-null class of the cache- Returns:
- inner cache object
- Throws:
NullPointerException- whenclazzis null
-