Skip to content

ElastiCache

# ElastiCache Cache Provider

Uses ElastiCache as the cache backend. This backend is based on the cache related parts of Spring Cloud AWS specifically Spring Cloud AWS Autoconfigure and Spring Cloud AWS Context.

This provider supports both memcached and Redis protocols as provided by Spring Cloud AWS. The memcached implementation relies on the Amazon ElastiCache Client implementation and the Redis caches uses Spring Data Redis. Consequently, this backend supports a dynamic configuration and delivers an enhanced memcached client based on Spymemcached to support the auto-discovery of new nodes based on a central configuration endpoint.

Install

maven:

<dependency>
    <groupId>io.mttrbit.spring.caches</groupId>
    <artifactId>elasticache-cache-provider</artifactId>
    <version>0.0.1</version>
</dependency>

gradle:

implementation "io.mttrbit.spring.caches:elasticache-cache-provider:0.0.1"

Additionally, you may want to use the module spring-caches-elasticache-starter as well, because it initializes the Amazon ElastiCache Client.

Configuration Properties

For the sake of this cache backend implementation, we moved the Cloud AWS related configuration properties into spring.caches.elasticache.aws as displayed below.

spring:
  caches:
    elasticache:
      aws: # optional
        credentials: ...
        region: ...
      clusters:
        - name: product-cache # name of clusters
          config:
            spec: recordStats,expiration=100
        - name: user-cache
          config:
            spec: recordStats,expiration=600
Back to top