Created
December 11, 2019 07:32
-
-
Save stefanotroia/5f41931d71ad3c483c52f2557589c5f9 to your computer and use it in GitHub Desktop.
HazelCast service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
@Slf4j | |
public class HazelcastService { | |
@Getter | |
private HazelcastInstance hzInstance; | |
@PostConstruct | |
private void init() { | |
// Running Hazelcast | |
hzInstance = Hazelcast.newHazelcastInstance(); | |
} | |
@Bean | |
public Config hazelCastConfig() { | |
//config cache setup | |
Config config = new Config(); | |
config.setInstanceName("EXAMPLE-CACHE"); | |
MapConfig ourCache = new MapConfig(); | |
ourCache.setTimeToLiveSeconds(1000); | |
ourCache.setEvictionPolicy(EvictionPolicy.LFU); | |
config.getMapConfigs().put("OUR_CACHE", ourCache); | |
return config; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment