Cache loader / writer for an AWS DynamoDB database backend.
Requirements
- Infinispan 9.4+
- Java 8+
- AWS DynamoDB database
Features
- Implements the complete
AdvancedLoadWriteStore
SPI. - Provides an interface for transforming Infinispan entries to / from structured DynamoDB items.
- Provides an optional interface for executing arbitrary queries against DynamoDB, bypassing the standard Infinispan load / store API.
- Optional support for enabling strongly consistent reads.
- Optional transparent application of a range key to facilitate
multi-tenancy: sharing a table among multiple Infinispan caches of
the same type, while keeping data access isolated. The
DynamoDBItemTransformer.getRangeKeyAttributeName()
method specifying a range key name overrides this configuration setting. - Optional transparent DynamoDB table name prefixing.
- Optional setting of a time-to-live (TTL) attribute.
- Optional server-side (data-at-rest) encryption when the DynamoDB table is created.
- Optional securing of the integrity and authenticity of the stored DynamoDB items with HMAC SHA-256.
- Optional continuous backups.
- Optional HTTP proxy.
- Optional creation of the DynamoDB table with an enabled stream of view type NEW_AND_OLD_IMAGES, required for setting up a global table with replicas in two or more AWS regions.
- Dropwizard Metrics: Read, put, delete, process and purge operation timers.
- System property interpolation for all configuration properties
using a
${sys-prop-name:default-value}
format. - Multi-level logging via Log4j2.
- Open source (Apache 2.0 license).
Usage
- Add the Maven dependency coordinates for the DynamoDB cache store to your project.
- Implement
DynamoDBItemTransformer
to translate between Infinispan entries (key / value pairs with optional metadata) and DynamoDB items. - Configure a DynamoDB store for each Infinispan cache that requires
one, by setting the attributes specified in
DynamoDBStoreConfiguration
. Also, see the example below. Note that the DynamoDB store can be safely shared between multiple replicated / distributed instances of a cache. It can also be used in read-only mode. - Make sure the AWS credentials for accessing the DynamoDB table(s)
are configured in way that the
default
AWS credentials provider chain can look them up, e.g. by
setting the
aws.accessKeyId
andaws.secretKey
Java system properties.
Maven
Maven coordinates:
<dependency> <groupId>com.nimbusds</groupId> <artifactId>infinispan-cachestore-dynamodb</artifactId> <version>[ version ]</version> </dependency>
where [ version ]
should be the latest stable version.
Example configuration
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:9.4 http://www.infinispan.org/schemas/infinispan-config-9.4.xsd" xmlns="urn:infinispan:config:9.4" xmlns:dynamodb="urn:infinispan:config:store:dynamodb:1.8"> <cache-container name="myCacheContainer" default-cache="users"> <jmx duplicate-domains="true"/> <local-cache name="users"> <eviction size="100"/> <persistence> <dynamodb:dynamodb-store shared="true" region="us-east-1" item-transformer="com.nimbusds.infinispan.persistence.dynamodb.UserItemTransformer" table-prefix="myapp_" /> </persistence> </local-cache> </cache-container> </infinispan>
Package | Description |
---|---|
com.nimbusds.infinispan.persistence.dynamodb |
DynamoDB store for Infinispan.
|
com.nimbusds.infinispan.persistence.dynamodb.config |
Configuration classes.
|
com.nimbusds.infinispan.persistence.dynamodb.logging |
Logging.
|
com.nimbusds.infinispan.persistence.dynamodb.query |
DynamoDB query executor interfaces.
|