Open lqn0011 opened 2 years ago
Hello, in case you still need an answer. You can use functionality from package https://github.com/go-redis/redis
var (
rdb = redis.NewClient(&redis.Options{
Addr: "localhost:6379",
DB: 0,
})
ctx = context.Background()
)
func FlushRedisCache() {
if _, err := rdb.Do(ctx, "flushdb").Result(); err != nil {
fmt.Println("ERROR: Could not flush Redis cache:", err.Error())
}
}
Thanks, this one is straightforward🤝.
How can we clear all cache with a function call?