A lua script which works in redis 2.6.x to copy all of the keys from database 0 to the same instance database X, where X is provided as an argument to the script.
This can be utilized to providing unit testing against a common database, but allowing each test run to have it’s own separate test area.
You can call it from the command line, or progmatically like:
EVAL script 0 [destination database instance]
Where script is the string test provided above, 0 stands for the TTL, and destination database instance is an integer.