Amazon ElastiCache provides two types of caching engines - Memcached and Redis. The choice of caching engine depends on the use case and requirements of the application.
By default, both engines store data in memory for faster read and write operations. However, data stored only in memory is volatile and can be lost if there is a node failure or maintenance activity. To overcome this issue, ElastiCache for Redis provides a feature called "Automatic Failover" that automatically promotes a replica node to the primary if the primary node fails. This ensures that the data is still available even after a node failure.
ElastiCache for Redis also provides options for data persistence - RDB (Redis Database Backup) and AOF (Append-Only File). RDB periodically saves a snapshot of the dataset to disk, while AOF logs every write operation and replays it in case of a restart. ElastiCache for Redis also allows configuring replication groups with Multi-AZ and read replicas, providing additional redundancy and failover options.
However, Amazon ElastiCache for Memcached does not provide data persistence or automatic failover features. It's designed to be a high-performance, distributed memory object caching system but doesn't guarantee durability of the data.
In summary, while ElastiCache for Redis provides options for both in-memory caching and persistence to disk, ensuring data availability and durability based on the requirements of the application, ElastiCache for Memcached is purely an in-memory cache with no built-in options for persistence or automatic failover.