Skip to content

drawmoon/hybrid-cache

Repository files navigation

hybrid-cache

Maven Central JavaDoc

A hybrid caching library.

Cache

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));

Get the latest release

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>

About

A hybrid caching library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages