Embedded cache client SDKs for Aeron Cache in multiple languages: Java, TypeScript, Python, and Rust with minimal external dependencies.
The goal of these libraries is to provide an "Embedded Cache" mode across languages. In this mode, the client maintains a local copy of the cache data which is kept in sync with the server via WebSocket updates, allowing for fast local reads.
| Language | Sync | Async | Streaming |
|---|---|---|---|
| Java | ✅ | ✅ | ✅ |
| Typescript | NA | ✅ | ✅ |
| Python | ✅ | ✅ | ✅ |
| Rust | ✅ | ✅ | ✅ |
var baseUrl = "http://localhost:7070";
var wsUrl = "http://localhost:7071";
AeronCacheClient client = new AeronCacheClient(baseUrl, wsUrl);
try {
client.createCache("async-sample-cache");
System.out.println("Created cache 'async-sample-cache'");
} catch (Exception e) {
e.printStackTrace();
}
EmbeddedAeronCache cache = new EmbeddedAeronCache(client, "async-sample-cache");
cache.put("stay", "tuned");const baseUrl = "http://localhost:7070";
const wsUrl = "http://localhost:7071";
const cacheClient = new AeronCacheClient(baseUrl, wsUrl);
try {
await cacheClient.createCache('async-sample-cache');
} catch (e) {
console.error(e);
}
const cache = new EmbeddedAeronCache(cacheClient, 'async-sample-cache');
await cache.put("stay", "tuned");See the samples/ directory for full code examples in all languages.
You can run all samples using the provided helper scripts:
This script runs the basic sync and async samples for all languages sequentially.
./run-all-samples.shThis script runs the streaming (Embedded Cache) samples for all languages in parallel. It captures the output from all languages into a single terminal window.
./run-streaming-samples.shNote: Press Ctrl+C to stop all parallel streaming processes.
- Business Status Mapping: Responses include an
operationStatusfield (e.g.,SUCCESS,CACHE_EXISTS,UNKNOWN_KEY) to handle business logic without throwing transport-level exceptions for HTTP 400 errors. - CRUD Operations: Full support for Create, Get, Put, Delete items and caches.
- Sync & Async: APIs available in both synchronous (blocking) and asynchronous (non-blocking) styles where appropriate.
- Embedded Aeron Cache: A specialized
EmbeddedAeronCacheobject that maintains a local shadowed copy of the cache data. It subscribes to the cache's WebSocket stream and applies updates (ADD_ITEM,REMOVE_ITEM,DELETE_CACHE,CLEAR_CACHE) to the local map automatically.
libraries/: Core client libraries.java/: Java client library.typescript/: TypeScript/JavaScript client library.python/: Python client library.rust/: Rust client library.
samples/: Example applications using each of the clients.