Infinispan
Infinispan is an open-source (Apache 2) in-memory key-value database and cache, can hold nearly any type of data, from plain-text to structured objects, is designed for high performance, scalability, and low-latency data access. It supports both embedded and client-server modes, allowing applications to use it as a local cache or a remote server database.
Infinispan is built in Java and provides features such as persistence, transactions, querying (full-text and vector search included), clustering, and support for Protobuf-based data indexing—making it suitable for use cases ranging from simple caching to complex real-time data processing in microservices and AI applications.
More in https://infinispan.org/
From 15.2 Infinispan Server and above, metadata filtering is supported.
Maven Dependency
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-infinispan</artifactId>
<version>1.24.0-beta34</version>
</dependency>
APIs
InfinispanEmbeddingStoreInfinispanChatMemoryStore
Both classes also implement the non-blocking methods of their interfaces: searchAsync on
InfinispanEmbeddingStore, and getMessagesAsync, updateMessagesAsync and deleteMessagesAsync on
InfinispanChatMemoryStore. They use the asynchronous API of the Infinispan Hot Rod client, so you can use them
in asynchronous and reactive AI Services and RAG without blocking a thread.
The returned futures complete on the I/O threads of the Hot Rod client, so do not block in code that you chain to them.
See Non-blocking and Reactive.
InfinispanChatMemoryStore
A ChatMemoryStore backed by an Infinispan cache. Messages are serialized to JSON
using ChatMessageSerializer, supporting all message types including multimodal
content (images, audio, video, PDF), tool calls, and provider-specific attributes.
// Using a ConfigurationBuilder
InfinispanChatMemoryStore store = InfinispanChatMemoryStore.builder()
.infinispanConfigBuilder(builder)
.build();
When using a pre-configured RemoteCacheManager (e.g. in Quarkus):
InfinispanChatMemoryStore store = InfinispanChatMemoryStore.builder()
.remoteCacheManager(remoteCacheManager)
.build();