@Override
    public void close() {
        if (isClosed()) {
            return;
        }

        if (closed.compareAndSet(false, true)) {
            if (hasOwnRedisson) {
                redisson.shutdown();
            }
            cacheManager.closeCache(this);
            for (CacheEntryListenerConfiguration<K, V> config : listeners.keySet()) {
                deregisterCacheEntryListener(config);
            }
            redisson.getEvictionScheduler().remove(getRawName());
        }
    }
@Test
    public void testClose() throws IOException {
        URL configUrl = getClass().getResource("redisson-jcache.yaml");
        Config cfg = Config.fromYAML(configUrl);

        MutableConfiguration c = new MutableConfiguration();
        c.setStatisticsEnabled(true);
        Configuration<String, String> config = RedissonConfiguration.fromConfig(cfg, c);
        Cache<String, String> cache = Caching.getCachingProvider()
                                                .getCacheManager().createCache("test", config);
        cache.close();
    }