Search in sources :

Example 1 with CaffeineConfiguration

use of com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration in project caffeine by ben-manes.

the class JCacheAccessExpiryTest method getConfiguration.

@Override
protected CaffeineConfiguration<Integer, Integer> getConfiguration() {
    CaffeineConfiguration<Integer, Integer> configuration = new CaffeineConfiguration<>();
    configuration.setExpiryPolicyFactory(() -> new AccessedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, EXPIRY_DURATION)));
    configuration.setTickerFactory(() -> ticker::read);
    return configuration;
}
Also used : Duration(javax.cache.expiry.Duration) AccessedExpiryPolicy(javax.cache.expiry.AccessedExpiryPolicy) CaffeineConfiguration(com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration)

Example 2 with CaffeineConfiguration

use of com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration in project caffeine by ben-manes.

the class JCacheUpdateExpiryTest method getConfiguration.

@Override
protected CaffeineConfiguration<Integer, Integer> getConfiguration() {
    CaffeineConfiguration<Integer, Integer> configuration = new CaffeineConfiguration<>();
    configuration.setExpiryPolicyFactory(() -> new ModifiedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, EXPIRY_DURATION)));
    configuration.setTickerFactory(() -> ticker::read);
    return configuration;
}
Also used : Duration(javax.cache.expiry.Duration) ModifiedExpiryPolicy(javax.cache.expiry.ModifiedExpiryPolicy) CaffeineConfiguration(com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration)

Example 3 with CaffeineConfiguration

use of com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration in project caffeine by ben-manes.

the class JCacheCreationExpiryTest method getConfiguration.

@Override
protected CaffeineConfiguration<Integer, Integer> getConfiguration() {
    CaffeineConfiguration<Integer, Integer> configuration = new CaffeineConfiguration<>();
    configuration.setExpiryPolicyFactory(() -> new CreatedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, EXPIRY_DURATION)));
    configuration.setTickerFactory(() -> ticker::read);
    return configuration;
}
Also used : Duration(javax.cache.expiry.Duration) CreatedExpiryPolicy(javax.cache.expiry.CreatedExpiryPolicy) CaffeineConfiguration(com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration)

Aggregations

CaffeineConfiguration (com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration)3 Duration (javax.cache.expiry.Duration)3 AccessedExpiryPolicy (javax.cache.expiry.AccessedExpiryPolicy)1 CreatedExpiryPolicy (javax.cache.expiry.CreatedExpiryPolicy)1 ModifiedExpiryPolicy (javax.cache.expiry.ModifiedExpiryPolicy)1