-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC-4445 server management command examples
- Loading branch information
1 parent
27ecd6c
commit 3f5789a
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/test/java/io/redis/examples/CmdsServerMgmtExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// EXAMPLE: cmds_servermgmt | ||
// REMOVE_START | ||
package io.redis.examples; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
// REMOVE_END | ||
import java.util.Set; | ||
|
||
// HIDE_START | ||
import redis.clients.jedis.UnifiedJedis; | ||
|
||
public class CmdsServerMgmtExample { | ||
@Test | ||
public void run() { | ||
UnifiedJedis jedis = new UnifiedJedis("redis://localhost:6379"); | ||
|
||
// STEP_START flushall | ||
//REMOVE_START | ||
jedis.set("testkey1", "1"); | ||
jedis.set("testkey2", "2"); | ||
jedis.set("testkey3", "3"); | ||
//REMOVE_END | ||
String flushAllResult1 = jedis.flushAll(); | ||
System.out.println(flushAllResult1); // >>> OK | ||
|
||
Set<String> flushAllResult2 = jedis.keys("*"); | ||
System.out.println(flushAllResult2); // >>> [] | ||
// STEP_END | ||
// REMOVE_START | ||
Assert.assertEquals("OK", flushAllResult1); | ||
Assert.assertEquals("[]", flushAllResult2.toString()); | ||
// REMOVE_END | ||
|
||
// STEP_START info | ||
|
||
// Not currently supported by Jedis. | ||
|
||
// STEP_END | ||
|
||
// HIDE_END | ||
} | ||
} |