Skip to main content

Flush cache for one site in redis

I'm testing a setup with redis as cache for a drupal site - and I'm still thinking about one redis as caching solution for several drupal sites without critical content. Although I don't think, that this is a good solution it can be OK for a multisite setup for one company, f.ex. 

What I found out so far: It's not possible to flush the cache for one site from drupal itself ... you need to flush it with a bash command. So I setup the cache with a prefix for the keys and then use following command, to flush the cache for only one site:

redis-cli --scan --pattern 'siteprefix:*' | xargs redis-cli del