QA
Beginner LevelCloud Computing (AWS/GCP/Azure)

What is Amazon ElastiCache and when should you choose Redis versus Memcached?

❓ Interview Prompt: Compare Amazon ElastiCache in-memory caching engines: Redis (data structures, persistence, replication) vs Memcached.

Amazon ElastiCache is a fully-managed in-memory data store service that accelerates database and application performance by caching frequent queries with sub-millisecond latency.

Engine Comparison:

1
Redis (Valkey / Redis Engine):
•
Features: Rich data structures (Hashes, Lists, Sets, Geospatial, Pub/Sub), data persistence, multi-AZ replication, and cluster sharding.
•
Use Case: Session stores, leaderboards, pub/sub messaging, and complex object caches.
2
Memcached:
•
Features: Pure multithreaded key-value memory store. No persistence or complex structures.
•
Use Case: Simple static HTML/JSON fragment caching requiring maximum horizontal multithreaded throughput.

Code Implementation Example

typescript
import Redis from 'ioredis';

// Connecting to ElastiCache Redis cluster endpoint
const redis = new Redis({
  host: 'my-cache.abc123.ng.001.use1.cache.amazonaws.com',
  port: 6379,
  tls: {} // Encryption in transit
});

// Cache database query for 60 seconds
async function getCachedUser(userId: string) {
  const cached = await redis.get("user:" + userId);
  if (cached) return JSON.parse(cached);

  const dbUser = await db.users.find(userId);
  await redis.set("user:" + userId, JSON.stringify(dbUser), 'EX', 60);
  return dbUser;
}
💡Caching database queries using Amazon ElastiCache Redis.
🎯 Interview Key Takeaway

ElastiCache Redis supports rich data structures, persistence, and replication; Memcached offers simple multithreaded caching.

#ElastiCache#Redis#Memcached#Caching#Beginner
Back to all Cloud Computing (AWS/GCP/Azure) Questions→

More Cloud Computing (AWS/GCP/Azure) Interview Questions

Beginner LevelCloud Computing (AWS/GCP/Azure)

How does Serverless Architecture (AWS Lambda / GCP Cloud Run) handle Auto-Scaling and Cold Starts?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is the difference between IaaS, PaaS, and SaaS cloud service models?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is AWS EC2 and what are On-Demand, Reserved, and Spot Instance pricing models?