Introduction to Infinispan
Distributed in-memory key/value database and cache
What is Infinispan?
Infinispan is an open source, in-memory key/value data store and cache written in Java. It distributes data across a cluster to provide high availability, fault tolerance, and elastic scaling. Infinispan can serve as a distributed cache, a NoSQL database, a vector store for AI applications, or an event store for real-time processing. It supports full-text search, relational queries, and kNN vector similarity search.
Ready to try it? Get started in minutes.
Why would I use it?
As a cache. Place Infinispan in front of a database or any system bottleneck to reduce latency and offload reads. In clustered deployments, Infinispan keeps cached data consistent across nodes automatically.
As a NoSQL data store. Store data in memory with optional persistent cache stores for durability. Cache stores are pluggable. Use the built-in JDBC, RocksDB, or remote store implementations, or write your own.
As an AI vector store. Store and query vector embeddings for Retrieval-Augmented Generation (RAG), semantic caching, and AI agent workflows. Infinispan integrates natively with LangChain4j, Spring AI, and LangChain.
For high availability. Embed Infinispan in your application to replicate or distribute state across a cluster with no single point of failure. Frameworks like Keycloak and WildFly use Infinispan for clustered session management and failover.
How do I use it?
Embedded. Add Infinispan as a library dependency. It exposes a Cache interface extending java.util.Map and forms a cluster automatically using JGroups peer-to-peer discovery.
Client/Server. Run Infinispan Server and connect over the Hot Rod binary protocol or REST API. Hot Rod client libraries exist for Java, C++, C#, Node.js, and Python.
See the tutorials for working examples of both modes.
Search and queries
Beyond key lookups, Infinispan provides indexed queries using the Ickle query language (a subset of HQL/JPQL), full-text search powered by Apache Lucene, and kNN vector similarity search for embeddings. Queries can run across the entire cluster, returning results from any node.
Learn more about AI search integrations on the Infinispan for AI page.
Transactions
Infinispan supports JTA and XA transactions and can participate in distributed transactions managed by a compliant transaction manager. Transactions are optional. Disable them when maximum throughput matters more than ACID guarantees.
Hibernate second-level cache
Infinispan implements the Hibernate ORM cache SPI. Use it as a second-level cache provider to cache entities, collections, and query results across your cluster with support for invalidation, replication, and distributed modes.
Distributed execution
Execute code co-located with your data using the Java Streams API, in both local and clustered modes. Infinispan also supports server-side tasks for custom logic deployed directly to the server.
Where can I learn more?
Explore the features page for a full overview of capabilities. Check the documentation for in-depth guides and API references, or jump straight into the tutorials with working code examples.


