Skip to content

java-suraj/ignite-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here is a sample README.md file with instructions on how to use the CacheService class in other applications:

CacheService Usage Guide

Introduction

The CacheService class provides methods to interact with an Apache Ignite cache. This guide will help you integrate and use the CacheService in your application.

Prerequisites

  • Java 21
  • Apache Ignite
  • Spring Boot
  • Maven

Setup

Maven Dependency

Add the following dependencies to your pom.xml:

<dependencies>
    <!-- Spring Boot Starter Cache -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
    <!-- Apache Ignite -->
    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-indexing</artifactId>
    </dependency>
</dependencies>

Configuration

Create a configuration class to initialize the Ignite instance and the CacheService:

import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IgniteConfig {

    @Bean
    public Ignite igniteInstance() {
        Ignite ignite = Ignition.ignite();
        if (ignite == null) {
            IgniteConfiguration cfg = new IgniteConfiguration();
            cfg.setClientMode(false);
            ignite = Ignition.start(cfg);
        }
        return ignite;
    }
}

Running the Application

Include below VM Args in your application to run Apache Ignite:

-Djava.net.preferIPv4Stack=true
-DIGNITE_REST_START_ON_CLIENT=true
--add-opens=java.base/jdk.internal.access=ALL-UNNAMED
--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED
--add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED
--add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED
--add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.math=ALL-UNNAMED
--add-opens=java.sql/java.sql=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.time=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED
--add-opens=java.management/sun.management=ALL-UNNAMED
--add-opens
java.desktop/java.awt.font=ALL-UNNAMED

Conclusion

This guide provides the basic steps to integrate and use the CacheService class in your application. For more advanced configurations and usage, refer to the Apache Ignite documentation.

About

This Application to create Ignite cache

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published