Search in sources :

Example 11 with CacheBuilder

use of org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder in project kylo by Teradata.

the class RepositoryConfig method templateUpdateInfoCache.

@Bean
public Cache<String, Boolean> templateUpdateInfoCache() {
    CacheBuilder builder = CacheBuilder.newBuilder();
    if (expireRepositoryCache) {
        builder.expireAfterWrite(1, TimeUnit.HOURS);
        log.info("Template repository cache initialized with expiry of 1 hour");
    }
    return builder.build();
}
Also used : CacheBuilder(com.google.common.cache.CacheBuilder) Bean(org.springframework.context.annotation.Bean)

Example 12 with CacheBuilder

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);
}
Also used : User(org.summerb.users.api.dto.User) CacheBuilder(com.google.common.cache.CacheBuilder)

Aggregations

CacheBuilder (com.google.common.cache.CacheBuilder)12 CacheLoader (com.google.common.cache.CacheLoader)2 CacheBackedStorageManager (com.hortonworks.registries.storage.CacheBackedStorageManager)2 Storable (com.hortonworks.registries.storage.Storable)2 StorableKey (com.hortonworks.registries.storage.StorableKey)2 StorageManager (com.hortonworks.registries.storage.StorageManager)2 StorageWriter (com.hortonworks.registries.storage.cache.writer.StorageWriter)2 InMemoryStorageManager (com.hortonworks.registries.storage.impl.memory.InMemoryStorageManager)1 OnScheduled (org.apache.nifi.annotation.lifecycle.OnScheduled)1 ComponentLog (org.apache.nifi.logging.ComponentLog)1 GuavaCacheTable (org.apache.samza.table.caching.guava.GuavaCacheTable)1 Test (org.junit.Test)1 Bean (org.springframework.context.annotation.Bean)1 User (org.summerb.microservices.users.api.dto.User)1 User (org.summerb.users.api.dto.User)1