/**
* Hazelcast cache manager that handles only cache names with a specified prefix for distributed caches
*/
public class OptionalHazelcastCacheManager extends HazelcastCacheManager {
private static final String DISTRIBUTED_CACHE_PREFIX = "d:";
public OptionalHazelcastCacheManager(HazelcastInstance hazelcast) {
super(hazelcast);
}
@Override
public Cache getCache(String name) {
if (name == null || !name.startsWith(DISTRIBUTED_CACHE_PREFIX)) {
return null;
}
return super.getCache(name);
}
}
|