docker compose down removes containers and networks and leaves named volumes, which is the safe default and the reason a database survives a version change you did not intend.
$ docker compose down
Removing network blog_default
# the mysql-data volume is still there
$ docker compose down -v # and now it is not
$ docker volume ls --filter dangling=true
DRIVER VOLUME NAME
local blog_mysql-data
local oldproject_mysql-data # from 2019
Keeping the volume is right for a database and wrong for a cache, and Compose has no way to express the difference. The failure this produces is changing the MySQL image tag, running up, and getting a server that refuses to start against a data directory written by a newer version — with an error in the container log that nobody reads because the container exited. Listing dangling volumes occasionally is worth a minute; some of them are from projects that no longer exist.