use of org.apache.samza.table.descriptors.GuavaCacheTableDescriptor in project samza by apache.
the class TestCachingTable method testSerializeWithCacheInstance.
@Test
public void testSerializeWithCacheInstance() {
String tableId = "guavaCacheId";
GuavaCacheTableDescriptor guavaTableDesc = new GuavaCacheTableDescriptor(tableId).withCache(CacheBuilder.newBuilder().build());
Map<String, String> tableConfig = guavaTableDesc.toConfig(new MapConfig());
assertExists(GuavaCacheTableDescriptor.GUAVA_CACHE, tableId, tableConfig);
doTestSerialize(guavaTableDesc);
}
use of org.apache.samza.table.descriptors.GuavaCacheTableDescriptor in project samza by apache.
the class TestRemoteTableEndToEnd method getCachingTable.
private <K, V> Table<KV<K, V>> getCachingTable(TableDescriptor<K, V, ?> actualTableDesc, boolean defaultCache, StreamApplicationDescriptor appDesc) {
String id = actualTableDesc.getTableId();
CachingTableDescriptor<K, V> cachingDesc;
if (defaultCache) {
cachingDesc = new CachingTableDescriptor<>("caching-table-" + id, actualTableDesc);
cachingDesc.withReadTtl(Duration.ofMinutes(5));
cachingDesc.withWriteTtl(Duration.ofMinutes(5));
} else {
GuavaCacheTableDescriptor<K, V> guavaTableDesc = new GuavaCacheTableDescriptor<>("guava-table-" + id);
guavaTableDesc.withCache(CacheBuilder.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES).build());
cachingDesc = new CachingTableDescriptor<>("caching-table-" + id, actualTableDesc, guavaTableDesc);
}
return appDesc.getTable(cachingDesc);
}
Aggregations