the files created by grav have no write access for the group www-data. I can’t delete the cache by the command line, because i am not the www-data user (but i am in the www-data group). I’ve been reading the documentation to this topic, but no solution is working (except running the server as another user, but i want to keep the www-data user for the apache). Is there any other solution? Is there an option to set group write access to the files?

The best place to learn about this is Did you already try to follow the steps, and the permission fixing script?

Yes, i executed this script, but it does not work. Every time the script is creating files, the files have the wrong rights (644 instead of 664) and i cant delete from the command line

the following command works, but i think thats not the way to do that:
sudo -u www-data bin/grav clear-cache