You can use simple example below to purge all Redis cache items in Golang. You can handle the errors appropriately. I am just cutting it short.


func PurgeRDS() {
itr := RDS.Scan(0, "*", 0).Iterator()
for iter.Next() {
err := RDS.Del(itr.Val()).Err()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
if err := itr.Err(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}