private long calculateCacheReadTimeout(String name) { Long timeout = getReadTimeoutMap().get(name); return timeout == null ? defaultReadTimeout : timeout; }
private void parseOptions(String options) { if (null == options || options.trim().isEmpty()) { return; } for (String option : options.split(",")) { parseOption(option); } }
/** * Set the cache ead-timeout params * * @param options cache read-timeout params, auto-wired by Spring automatically by getting value of * hazelcast.spring.cache.prop parameter */ @Autowired public void setCacheOptions(@Value("${" + CACHE_PROP + ":}") String options) { parseOptions(options); } }
@Override public Cache getCache(String name) { Cache cache = caches.get(name); if (cache == null) { IMap<Object, Object> map = hazelcastInstance.getMap(name); cache = new HazelcastCache(map); long cacheTimeout = calculateCacheReadTimeout(name); ((HazelcastCache) cache).setReadTimeout(cacheTimeout); Cache currentCache = caches.putIfAbsent(name, cache); if (currentCache != null) { cache = currentCache; } } return cache; }
@Bean CacheManager cacheManager() { return new HazelcastCacheManager(hazelcastInstance()); }
@Override public Cache getCache(String name) { Cache cache = caches.get(name); if (cache == null) { IMap<Object, Object> map = hazelcastInstance.getMap(name); cache = new HazelcastCache(map); long cacheTimeout = calculateCacheReadTimeout(name); ((HazelcastCache) cache).setReadTimeout(cacheTimeout); Cache currentCache = caches.putIfAbsent(name, cache); if (currentCache != null) { cache = currentCache; } } return cache; }
@Bean public CacheManager cacheManager() { ClientConfig config = new ClientConfig(); config.getGroupConfig().setName("grp"); config.getGroupConfig().setPassword("grp-pass"); config.getNetworkConfig().addAddress("127.0.0.1:5701"); HazelcastInstance client = HazelcastClient.newHazelcastClient(config); return new HazelcastCacheManager(client); }
/** * Set the cache ead-timeout params * * @param options cache read-timeout params, auto-wired by Spring automatically by getting value of * hazelcast.spring.cache.prop parameter */ @Autowired public void setCacheOptions(@Value("${" + CACHE_PROP + ":}") String options) { parseOptions(options); } }
private void parseOptions(String options) { if (null == options || options.trim().isEmpty()) { return; } for (String option : options.split(",")) { parseOption(option); } }
private long calculateCacheReadTimeout(String name) { Long timeout = getReadTimeoutMap().get(name); return timeout == null ? defaultReadTimeout : timeout; }
@Override public Cache getCache(String name) { Cache cache = caches.get(name); if (cache == null) { IMap<Object, Object> map = hazelcastInstance.getMap(name); cache = new HazelcastCache(map); long cacheTimeout = calculateCacheReadTimeout(name); ((HazelcastCache) cache).setReadTimeout(cacheTimeout); Cache currentCache = caches.putIfAbsent(name, cache); if (currentCache != null) { cache = currentCache; } } return cache; }
/** * Set the cache ead-timeout params * * @param options cache read-timeout params, auto-wired by Spring automatically by getting value of * hazelcast.spring.cache.prop parameter */ @Autowired public void setCacheOptions(@Value("${" + CACHE_PROP + ":}") String options) { parseOptions(options); } }
private void parseOptions(String options) { if (null == options || options.trim().isEmpty()) { return; } for (String option : options.split(",")) { parseOption(option); } }
private long calculateCacheReadTimeout(String name) { Long timeout = getReadTimeoutMap().get(name); return timeout == null ? defaultReadTimeout : timeout; }