From 84a9ca377846a8949e634f87c0a735ef58f1b139 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Mon, 15 Jun 2020 18:49:14 +0000 Subject: [PATCH] added share/scripts --- share/scripts/remove-from-cache.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 share/scripts/remove-from-cache.sh diff --git a/share/scripts/remove-from-cache.sh b/share/scripts/remove-from-cache.sh new file mode 100755 index 00000000..fb257b30 --- /dev/null +++ b/share/scripts/remove-from-cache.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +remove_by_name() +{ + local query; query="$1" + local q + + redis-cli KEYS "$query" | while read -r q; do + redis-cli DEL "$q" + done +} + +if [ -z "$1" ]; then + echo Usage: + echo + echo " $0 QUERY" + exit 1 +fi + +remove_by_name "$1"