php - Why moodle saying Unable to save the cache config to file

one text

I tried to give write permission to moodledata folder like

sudo chmod 777

Then i try to run my moodle site but it's giving me

Unable to save the cache config to file.

I tried to clear cache using

php admin/cli/purge_caches.php

But this command is also giving me same error

Source