A hybrid caching library.
try (HybridCache hybridCache = new HybridCache()) {
hybridCache.set("key", "value");
String val = hybridCache.get("key", String.class);
}
Using redis, caches to redis by default, or in-memory if redis is not available:
try (HybridCache hybridCache =
new HybridCache(option -> option.getRedisCacheOptions().setConfiguration("127.0.0.1:6379"))) {
hybridCache.set("key", "value");
String val = hybridCache.get("key", String.class);
}
If you don't want hybrid-cache
to automatically select a cache location, you can specify it manually:
hybridCache.set("key", "value", options -> options.setCachePlace(HybridCachePlace.MEMORY));
Download from Maven Central.
Alternatively, you can pull it from the central Maven repositories:
<dependency>
<groupId>io.github.drawmoon.hybridcache</groupId>
<artifactId>hybridcache</artifactId>
<version>0.0.1</version>
</dependency>