CloudCache provides managed Redis instances for your applications. It abstracts away the complexity of managing Redis containers, networking, and configuration.
- Managed Redis: Automatically provision and manage Redis instances.
- Version Support: Supports Redis 7.2 (default) and other versions via provided image tags.
- Custom Configuration: Configure memory limits and password authentication details are handled automatically.
- VPC Integration: Deploy caches into specific VPCs for isolation (caches are currently accessible via host networking in this simulator version, but VPC IDs are tracked).
- Persistence: AOF (Append Only File) persistence is enabled by default.
- Monitoring: Basic stats (memory usage) available.
CloudCache follows the thecloud 3-tier architecture:
- API: Handles requests validation, DB state management, and orchestration.
- Service:
CacheServicemanages the business logic and orchestrates Docker containers. - Repository:
CacheRepository(Postgres) stores metadata. - Infrastructure: Uses Docker to spawn
redis:alpinecontainers.
Containers are launched with:
redis-server --appendonly yes --requirepass <generated_password> --maxmemory <limit>mb- Exposed on a random host port mapped to 6379.
-
Create a Cache
cloud cache create --name my-cache --memory 256 --wait
-
List Caches
cloud cache list
-
Get Connection String
cloud cache connection my-cache
Output:
redis://:password@localhost:32768 -
View Details
cloud cache show my-cache
-
Delete Cache
cloud cache rm my-cache
import "github.com/poyrazk/thecloud/pkg/sdk"
client := sdk.NewClient(apiKey)
// Create
cache, err := client.CreateCache("app-cache", "7.2", 512, nil)
// Connect
connStr, err := client.GetCacheConnectionString(cache.ID)
// Use with go-redis
rdb := redis.NewClient(&redis.Options{Addr: connStr})- TLS: Not enabled by default. Traffic is unencrypted.
- Clustering: Single node only.
- Public Access: Exposed on localhost/host-ip. Use Security Groups (future) or VPC peering for restrictions.
- Flush:
flushcommand is currently a placeholder (requires Exec implementation).
- Memory 0MB: Ensure you specify valid memory limits > 0.
- Connection Refused: Ensure the instance status is
RUNNINGand you are using the correct mapped port fromcloud cache show.