Class CmsObjectCacheConfiguration

java.lang.Object
com.cloudforgeci.api.core.topology.CmsObjectCacheConfiguration

public final class CmsObjectCacheConfiguration extends Object
ElastiCache Redis/Memcached configuration for CMS object caching.

Creates ElastiCache clusters with appropriate configuration for CMS object caching, session storage, and page caching.

Features:

  • Redis or Memcached clusters
  • Subnet group in VPC private subnets
  • Security group integration
  • AUTH password via Secrets Manager
  • In-transit encryption (TLS)
  • At-rest encryption for production
Since:
3.1.0
  • Method Details

    • createRedisCluster

      public static software.amazon.awscdk.services.elasticache.CfnCacheCluster createRedisCluster(SystemContext ctx, ApplicationSpec spec)
      Create ElastiCache Redis cluster for object caching (or, for non-CMS callers such as CloudForgeManagerApplicationSpec, a Redis-backed session store).

      Only ApplicationSpec.applicationId()/ApplicationSpec.displayName() are used, so any ApplicationSpec works here — CmsSpec extends it and remains a valid argument unchanged.

      Parameters:
      ctx - the SystemContext
      spec - the application specification
      Returns:
      Redis cache cluster
    • createRedisReplicationGroup

      public static software.amazon.awscdk.services.elasticache.CfnReplicationGroup createRedisReplicationGroup(SystemContext ctx, ApplicationSpec spec, int numReplicas)
      Create ElastiCache Redis replication group for high availability.

      Creates a Redis replication group with:

      • Primary node + read replicas
      • Automatic failover
      • Multi-AZ deployment
      • In-transit and at-rest encryption
      Parameters:
      ctx - the SystemContext
      spec - the application specification
      numReplicas - number of read replicas (0-5 — 0 is a valid, supported single-node/no- failover configuration, see automaticFailoverEnabled(numReplicas > 0) below; 5 is ElastiCache's own hard ceiling of 6 total nodes per replication group)
      Returns:
      Redis replication group
      Throws:
      IllegalArgumentException - if numReplicas is outside 0-5
    • createMemcachedCluster

      public static software.amazon.awscdk.services.elasticache.CfnCacheCluster createMemcachedCluster(SystemContext ctx, ApplicationSpec spec)
      Create ElastiCache Memcached cluster.
      Parameters:
      ctx - the SystemContext
      spec - the application specification
      Returns:
      Memcached cache cluster
    • createRedisEnvironment

      public static Map<String,String> createRedisEnvironment(String endpoint, int port, CmsSpec spec)
      Create environment variables for Redis connection.
      Parameters:
      endpoint - Redis primary endpoint
      port - Redis port
      spec - the CMS specification
      Returns:
      map of environment variables
    • createMemcachedEnvironment

      public static Map<String,String> createMemcachedEnvironment(String endpoint, int port, CmsSpec spec)
      Create environment variables for Memcached connection.
      Parameters:
      endpoint - Memcached configuration endpoint
      port - Memcached port
      spec - the CMS specification
      Returns:
      map of environment variables