K
- type of the key in the cacheV
- type of the value in the cachepublic class CachingTableDescriptor<K,V> extends HybridTableDescriptor<K,V,CachingTableDescriptor<K,V>>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CACHE_SIZE |
static java.lang.String |
CACHE_TABLE_ID |
static java.lang.String |
PROVIDER_FACTORY_CLASS_NAME |
static java.lang.String |
READ_TTL_MS |
static java.lang.String |
REAL_TABLE_ID |
static java.lang.String |
WRITE_AROUND |
static java.lang.String |
WRITE_TTL_MS |
config, tableId
Constructor and Description |
---|
CachingTableDescriptor(java.lang.String tableId,
TableDescriptor<K,V,?> table)
Constructs a table descriptor instance with internal cache
|
CachingTableDescriptor(java.lang.String tableId,
TableDescriptor<K,V,?> table,
TableDescriptor<K,V,?> cache)
Constructs a table descriptor instance and specify a cache (as Table descriptor)
to be used for caching.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getProviderFactoryClassName()
Return the fully qualified class name of the
TableProviderFactory |
java.util.List<? extends TableDescriptor<K,V,?>> |
getTableDescriptors()
Retrieve user-defined table descriptors contained in this table
|
java.util.Map<java.lang.String,java.lang.String> |
toConfig(Config jobConfig)
Generate configuration for this table descriptor, the generated configuration
should be the complete configuration for this table that can be directly
included in the job configuration.
|
protected void |
validate()
Validate that this table descriptor is constructed properly; this method is used internally.
|
CachingTableDescriptor<K,V> |
withCacheSize(long cacheSize)
Specify the max cache size for size-based eviction.
|
CachingTableDescriptor<K,V> |
withReadTtl(java.time.Duration readTtl)
Specify the TTL for each read access, ie.
|
CachingTableDescriptor<K,V> |
withWriteAround()
Specify if write-around policy should be used to bypass writing
to cache for put operations.
|
CachingTableDescriptor<K,V> |
withWriteTtl(java.time.Duration writeTtl)
Specify the TTL for each write access, ie.
|
addTableConfig, getTableId, withConfig
public static final java.lang.String PROVIDER_FACTORY_CLASS_NAME
public static final java.lang.String REAL_TABLE_ID
public static final java.lang.String CACHE_TABLE_ID
public static final java.lang.String READ_TTL_MS
public static final java.lang.String WRITE_TTL_MS
public static final java.lang.String CACHE_SIZE
public static final java.lang.String WRITE_AROUND
public CachingTableDescriptor(java.lang.String tableId, TableDescriptor<K,V,?> table)
tableId
- Id of the table, it must conform to pattern { @literal [\\d\\w-_]+ }table
- target table descriptorpublic CachingTableDescriptor(java.lang.String tableId, TableDescriptor<K,V,?> table, TableDescriptor<K,V,?> cache)
tableId
- Id of the table, it must conform to pattern { @literal [\\d\\w-_]+ }table
- target table descriptorcache
- cache table descriptorpublic java.util.List<? extends TableDescriptor<K,V,?>> getTableDescriptors()
getTableDescriptors
in class HybridTableDescriptor<K,V,CachingTableDescriptor<K,V>>
public CachingTableDescriptor<K,V> withReadTtl(java.time.Duration readTtl)
readTtl
- read TTLpublic CachingTableDescriptor<K,V> withWriteTtl(java.time.Duration writeTtl)
writeTtl
- write TTLpublic CachingTableDescriptor<K,V> withCacheSize(long cacheSize)
cacheSize
- max size of the cachepublic CachingTableDescriptor<K,V> withWriteAround()
public java.lang.String getProviderFactoryClassName()
BaseTableDescriptor
TableProviderFactory
getProviderFactoryClassName
in class BaseTableDescriptor<K,V,CachingTableDescriptor<K,V>>
TableProviderFactory
public java.util.Map<java.lang.String,java.lang.String> toConfig(Config jobConfig)
TableDescriptor
jobConfig
.toConfig
in interface TableDescriptor<K,V,CachingTableDescriptor<K,V>>
toConfig
in class BaseTableDescriptor<K,V,CachingTableDescriptor<K,V>>
jobConfig
- job configurationprotected void validate()
BaseTableDescriptor
validate
in class BaseTableDescriptor<K,V,CachingTableDescriptor<K,V>>