Question: What is Apache Distributed Cache and how to set it up?


Apache Distributed Cache refers to caching solutions provided by the Apache Foundation, which include Apache Ignite and Apache Geode. These are memory-centric platforms used for transactional, analytical, and caching workloads enabling in-memory speed and massive scalability.

Here's a basic guide on setting up Apache Ignite as an example of Apache Distributed Cache.


  • Java 8 or later versions
  • Apache Ignite binary distribution downloaded from the official site


  1. Extract the Apache Ignite Binary

You can extract the Apache Ignite binary using the following command

tar -xvf

This will create a directory named apache-ignite-{version}-bin.

  1. Start an Ignite Node

Navigate to the bin directory inside the extracted folder and execute the (for Linux/Mac) or ignite.bat (for Windows) script.

cd apache-ignite-fabric-2.8.1-bin/bin ./

Once you execute the script, an Ignite node will get started.

  1. Cache Configuration

To use Ignite as a distributed cache, you need to configure the cache first. Here is an example of a simple cache configuration:

IgniteConfiguration cfg = new IgniteConfiguration(); // Create a new cache configuration. CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>("myCache"); // Configure the cache. cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheCfg.setBackups(1); cfg.setCacheConfiguration(cacheCfg);
  1. Using the Distributed Cache

After the cache configuration, you can use Ignite's cache API to interact with the distributed cache:

Ignite ignite = Ignition.start(cfg); // Get the instance of the configured cache. IgniteCache<Integer, String> cache = ignite.getOrCreateCache("myCache"); // Perform operations on the cache. cache.put(1, "Hello"); System.out.println("Value for 1: " + cache.get(1));

Please note that this is a simplified version of the setup process. For production environments, more complex configurations might be necessary.

Was this content helpful?

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.