use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project summerb by skarpushin.
the class UserServiceCachedImpl method afterPropertiesSet.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void afterPropertiesSet() throws Exception {
CacheBuilder cacheBuilder = (CacheBuilder) CacheBuilder.newBuilder().maximumSize(1000).recordStats();
cacheByEmail = new TransactionBoundCache<String, User>("UserCacheByEmail", cacheBuilder, loaderByEmail);
cacheByUuid = new TransactionBoundCache<String, User>("UserCacheByUuid", cacheBuilder, loaderByUuid);
eventBus.register(this);
}
use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project streamline by hortonworks.
the class TestApplication method getCacheBackedDao.
private StorageManager getCacheBackedDao(TestConfiguration testConfiguration) {
StorageProviderConfiguration storageProviderConfiguration = testConfiguration.getStorageProviderConfiguration();
final StorageManager dao = getStorageManager(storageProviderConfiguration);
final CacheBuilder cacheBuilder = getGuavaCacheBuilder();
final Cache<StorableKey, Storable> cache = getCache(dao, cacheBuilder);
final StorageWriter storageWriter = getStorageWriter(dao);
return doGetCacheBackedDao(cache, storageWriter);
}
use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project registry by hortonworks.
the class TestApplication method getCacheBackedDao.
private StorageManager getCacheBackedDao(TestConfiguration testConfiguration) {
StorageProviderConfiguration storageProviderConfiguration = testConfiguration.getStorageProviderConfiguration();
final StorageManager dao = getStorageManager(storageProviderConfiguration);
final CacheBuilder cacheBuilder = getGuavaCacheBuilder();
final Cache<StorableKey, Storable> cache = getCache(dao, cacheBuilder);
final StorageWriter storageWriter = getStorageWriter(dao);
return doGetCacheBackedDao(cache, storageWriter);
}
use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project registry by hortonworks.
the class GuavaCacheTest method setCache.
private static void setCache() {
final InMemoryStorageManager dao = new InMemoryStorageManager();
final CacheBuilder cacheBuilder = getGuavaCacheBuilder();
cache = getCache(dao, cacheBuilder);
}
use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project samza by apache.
the class CachingTableProvider method createDefaultCacheTable.
private ReadWriteUpdateTable createDefaultCacheTable(String tableId, JavaTableConfig tableConfig) {
long readTtlMs = Long.parseLong(tableConfig.getForTable(tableId, CachingTableDescriptor.READ_TTL_MS, "-1"));
long writeTtlMs = Long.parseLong(tableConfig.getForTable(tableId, CachingTableDescriptor.WRITE_TTL_MS, "-1"));
long cacheSize = Long.parseLong(tableConfig.getForTable(tableId, CachingTableDescriptor.CACHE_SIZE, "-1"));
CacheBuilder cacheBuilder = CacheBuilder.newBuilder();
if (readTtlMs != -1) {
cacheBuilder.expireAfterAccess(readTtlMs, TimeUnit.MILLISECONDS);
}
if (writeTtlMs != -1) {
cacheBuilder.expireAfterWrite(writeTtlMs, TimeUnit.MILLISECONDS);
}
if (cacheSize != -1) {
cacheBuilder.maximumSize(cacheSize);
}
logger.info(String.format("Creating default cache with: readTtl=%d, writeTtl=%d, maxSize=%d", readTtlMs, writeTtlMs, cacheSize));
GuavaCacheTable cacheTable = new GuavaCacheTable(tableId + "-def-cache", cacheBuilder.build());
cacheTable.init(this.context);
return cacheTable;
}
Aggregations