Question: Is ElastiCache persistent?

Answer

ElastiCache provides two types of caching engines: Memcached and Redis. Both Memcached and Redis have different options for data persistence.

Memcached engine in ElastiCache is designed to be an in-memory cache, which means it does not provide any built-in mechanism for persistent storage of cached data. This implies that the cached data will be lost if the node(s) hosting the cache cluster fail or when the cache cluster is modified, restarted, or deleted. However, you can use Memcached's write-through or write-behind caching patterns to store a copy of the data in a database or disk, ensuring that the data is retrievable if the cache is lost.

On the other hand, Redis engine in ElastiCache provides multiple options for persistent storage of cached data. Redis has an option to persist data to disk regularly (Snapshotting), and also provides an append-only file (AOF) option that logs all changes made to data in Redis. Redis also allows specifying a retention period for keys, allowing old data to be automatically removed after a certain period. Redis provides various durability levels, from no persistence to high availability with automatic or manual failover.

In summary, whether ElastiCache is persistent depends on the caching engine used. Memcached is designed as an in-memory cache without any built-in mechanism for persistent storage, while Redis provides multiple options for persistent storage.

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.