Delete One key
- Copy
REDISTOGO_URLfrom heroku (powr-outlet) - Go to rails console and follow these instructions
OUTLET_REDIS = Redis.new(url: 'REDISTOGO_URL') # from heroku
OUTLET_REDIS.del(key) #assuming you already know key
Delete Multiple keys
- Copy
REDISTOGO_URLfrom heroku (powr-outlet) - Go to rails console and follow these instructions
OUTLET_REDIS = Redis.new(url: 'REDISTOGO_URL') # from heroku
OUTLET_REDIS.keys.each do |key|
if key.include?('youtube') # or whatever
puts "Clearing Key #{key}"
OUTLET_REDIS.del(key)
end
end
Update Multiple key's TTL (expiry)
- Copy
REDISTOGO_URLfrom heroku (powr-outlet) - Go to rails console and follow these instructions
OUTLET_REDIS = Redis.new(url: 'REDISTOGO_URL') # from heroku
OUTLET_REDIS.keys.each do |key|
if key.include?('youtube') # or whatever
seconds = 300
puts "Expiring Key #{key} in #{seconds} seconds"
OUTLET_REDIS.expire(key, seconds)
end
end