use of cn.taketoday.cache.Cache.ValueWrapper in project today-framework by TAKETODAY.
the class CaffeineCacheTests method testLoadingCacheGetWithType.
@Test
void testLoadingCacheGetWithType() {
String value = "value";
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder().build(key -> value));
String valueWrapper = loadingCache.get(new Object(), String.class);
assertThat(valueWrapper).isNotNull();
assertThat(valueWrapper).isEqualTo(value);
}
use of cn.taketoday.cache.Cache.ValueWrapper in project today-framework by TAKETODAY.
the class CaffeineCacheTests method testLoadingCacheGet.
@Test
void testLoadingCacheGet() {
Object value = new Object();
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder().build(key -> value));
ValueWrapper valueWrapper = loadingCache.get(new Object());
assertThat(valueWrapper).isNotNull();
assertThat(valueWrapper.get()).isEqualTo(value);
}
use of cn.taketoday.cache.Cache.ValueWrapper in project today-infrastructure by TAKETODAY.
the class CaffeineCacheTests method testLoadingCacheGet.
@Test
void testLoadingCacheGet() {
Object value = new Object();
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder().build(key -> value));
ValueWrapper valueWrapper = loadingCache.get(new Object());
assertThat(valueWrapper).isNotNull();
assertThat(valueWrapper.get()).isEqualTo(value);
}
use of cn.taketoday.cache.Cache.ValueWrapper in project today-infrastructure by TAKETODAY.
the class CaffeineCacheTests method testLoadingCacheGetWithType.
@Test
void testLoadingCacheGetWithType() {
String value = "value";
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder().build(key -> value));
String valueWrapper = loadingCache.get(new Object(), String.class);
assertThat(valueWrapper).isNotNull();
assertThat(valueWrapper).isEqualTo(value);
}
Aggregations