66import io .github .xanthic .cache .core .AbstractCacheProvider ;
77import org .infinispan .commons .api .CacheContainerAdmin ;
88import org .infinispan .configuration .cache .ConfigurationBuilder ;
9- import org .infinispan .configuration .global .GlobalConfigurationBuilder ;
109import org .infinispan .manager .DefaultCacheManager ;
10+ import org .infinispan .manager .EmbeddedCacheManager ;
1111
1212import java .util .UUID ;
1313import java .util .concurrent .TimeUnit ;
1818 * Implements size and time-based expiry.
1919 */
2020public final class InfinispanProvider extends AbstractCacheProvider {
21+ private static final EmbeddedCacheManager MANAGER = new DefaultCacheManager ();
22+
2123 @ Override
2224 public <K , V > Cache <K , V > build (ICacheSpec <K , V > spec ) {
23- GlobalConfigurationBuilder global = GlobalConfigurationBuilder .defaultClusteredBuilder ();
24- DefaultCacheManager manager = new DefaultCacheManager (global .build ());
25-
2625 ConfigurationBuilder builder = new ConfigurationBuilder ();
26+ builder .simpleCache (true );
2727 if (spec .maxSize () != null ) builder .memory ().maxCount (spec .maxSize ());
2828 handleExpiration (spec .expiryTime (), spec .expiryType (), (time , type ) -> {
2929 if (type == ExpiryType .POST_WRITE )
@@ -32,9 +32,9 @@ public <K, V> Cache<K, V> build(ICacheSpec<K, V> spec) {
3232 builder .expiration ().maxIdle (time .toNanos (), TimeUnit .NANOSECONDS );
3333 });
3434
35- org .infinispan .Cache <K , V > cache = manager .administration ()
35+ org .infinispan .Cache <K , V > cache = MANAGER .administration ()
3636 .withFlags (CacheContainerAdmin .AdminFlag .VOLATILE )
37- .getOrCreateCache (UUID .randomUUID ().toString (), builder .build ());
37+ .createCache (UUID .randomUUID ().toString (), builder .build ());
3838
3939 if (spec .removalListener () != null ) {
4040 cache .addFilteredListener (
0 commit comments