I want to FLUSHALL redis every time the Rails server starts.
How can I do this?
Thanks in Advance.
P.S: I am new to rails, so excuse me if the question is very easy.
FLUSHALL [ ASYNC | SYNC]Delete all the keys of all the existing databases, not just the currently selected one. This command never fails. By default, FLUSHALL will synchronously flush all the databases.
To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.
To clear data of a DCS Redis 4.0 or 5.0 instance, you can run the FLUSHDB or FLUSHALL command in redis-cli, use the data clearing function on the DCS console, or run the FLUSHDB command on Web CLI. To clear data of a Redis Cluster instance, run the FLUSHDB or FLUSHALL command on every shard of the instance.
Redis Commands There are two major commands to delete the keys present in Redis: FLUSHDB and FLUSHALL. We can use the Redis CLI to execute these commands. The FLUSHDB command deletes the keys in a database. And the FLUSHALL command deletes all keys in all databases.
port = 10000
$redis = Redis.new(:port => port)
$redis.flushall
http://fhwang.net/2010/09/23/Testing-Rails-against-a-running-Redis-instance-and-doing-it-with-Hydra-to-boot
To run that on start up check https://stackoverflow.com/a/7091991/643500
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With