@Test public void defaultShiroActiveSessionCacheConfigurationTest() throws Exception { when(cacheHelper.maybeCreateCache(anyString(), confCaptor.capture())).thenReturn(null); underTest.maybeCreateCache(CachingSessionDAO.ACTIVE_SESSION_CACHE_NAME); assertThat(confCaptor.getValue(), is(EternalExpiryPolicy.factoryOf())); }
@VisibleForTesting <K, V> javax.cache.Cache<K, V> maybeCreateCache(final String name) { if (Objects.equals(ACTIVE_SESSION_CACHE_NAME, name)) { return cacheHelperProvider.get().maybeCreateCache(name, EternalExpiryPolicy.factoryOf()); } else { Time timeToLive = Optional.ofNullable(System.getProperty(name + ".timeToLive")) .map(Time::parse) .orElse(defaultTimeToLive.get()); return cacheHelperProvider.get().maybeCreateCache(name, CreatedExpiryPolicy.factoryOf(new Duration(timeToLive.getUnit(), timeToLive.getValue()))); } }
ShiroJCacheManagerAdapter extends ComponentSupport implements CacheManager { @VisibleForTesting <K, V> javax.cache.Cache<K, V> maybeCreateCache(final String name) { if (Objects.equals(ACTIVE_SESSION_CACHE_NAME, name)) { return cacheHelperProvider.get().maybeCreateCache(name, EternalExpiryPolicy.factoryOf()); } else { Time timeToLive = Optional.ofNullable(System.getProperty(name + ".timeToLive")) .map(Time::parse) .orElse(defaultTimeToLive.get()); return cacheHelperProvider.get().maybeCreateCache(name, CreatedExpiryPolicy.factoryOf(new Duration(timeToLive.getUnit(), timeToLive.getValue()))); } } }
ShiroJCacheManagerAdapter extends ComponentSupport implements CacheManager { @VisibleForTesting <K, V> javax.cache.Cache<K, V> maybeCreateCache(final String name) { if (Objects.equals(ACTIVE_SESSION_CACHE_NAME, name)) { return cacheHelperProvider.get().maybeCreateCache(name, EternalExpiryPolicy.factoryOf()); } else { Time timeToLive = Optional.ofNullable(System.getProperty(name + ".timeToLive")) .map(Time::parse) .orElse(defaultTimeToLive.get()); return cacheHelperProvider.get().maybeCreateCache(name, CreatedExpiryPolicy.factoryOf(new Duration(timeToLive.getUnit(), timeToLive.getValue()))); } } ShiroJCacheManagerAdapter(final Provider<CacheHelper> cacheHelperProvider,
                                   final Provider<Time> defaultTimeToLive); }
ShiroJCacheManagerAdapter extends ComponentSupport implements CacheManager { @VisibleForTesting <K, V> javax.cache.Cache<K, V> maybeCreateCache(final String name) { if (Objects.equals(ACTIVE_SESSION_CACHE_NAME, name)) { return cacheHelperProvider.get().maybeCreateCache(name, EternalExpiryPolicy.factoryOf()); } else { Time timeToLive = Optional.ofNullable(System.getProperty(name + ".timeToLive")) .map(Time::parse) .orElse(defaultTimeToLive.get()); return cacheHelperProvider.get().maybeCreateCache(name, CreatedExpiryPolicy.factoryOf(new Duration(timeToLive.getUnit(), timeToLive.getValue()))); } } ShiroJCacheManagerAdapter(final Provider<CacheHelper> cacheHelperProvider,
                                   final Provider<Time> defaultTimeToLive); @Override Cache<K, V> getCache(final String name); }
ShiroJCacheManagerAdapter extends ComponentSupport implements CacheManager { @VisibleForTesting <K, V> javax.cache.Cache<K, V> maybeCreateCache(final String name) { if (Objects.equals(ACTIVE_SESSION_CACHE_NAME, name)) { return cacheHelperProvider.get().maybeCreateCache(name, EternalExpiryPolicy.factoryOf()); } else { Time timeToLive = Optional.ofNullable(System.getProperty(name + ".timeToLive")) .map(Time::parse) .orElse(defaultTimeToLive.get()); return cacheHelperProvider.get().maybeCreateCache(name, CreatedExpiryPolicy.factoryOf(new Duration(timeToLive.getUnit(), timeToLive.getValue()))); } } ShiroJCacheManagerAdapter(final Provider<CacheHelper> cacheHelperProvider,
                                   final Provider<Time> defaultTimeToLive); @Override Cache<K, V> getCache(final String name);  }