No, by default, Memcached doesn't write data to disk. It stores all its data in memory, which makes it extremely fast for read and write operations. However, this also means that if the server crashes or is restarted, all data stored in Memcached will be lost.
Memcached provides an option to persist data to disk using the
-s option when starting the server. This option allows you to specify a file path where Memcached will store data in case of a server restart or crash. By doing so, you can ensure that cached data is not lost, even if the server goes down.
Here's an example of how to start Memcached with persistent storage:
memcached -m 64 -p 11211 -u memcached -l 127.0.0.1 -s /path/to/memcached/data/file
-s option specifies the path to the file where Memcached should store its data. You can use any file path as long as the user under which Memcached is running has write access to the directory.
It's worth noting that using persistent storage might impact the performance of Memcached since it adds disk I/O operations to read and write operations, making them slower. Therefore, it's recommended to carefully consider your use case before enabling persistent storage.
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.