Implemented LASTSAVE
This commit is contained in:
@@ -523,4 +523,8 @@ public class Client extends Connection {
|
|||||||
public void bgrewriteaof() {
|
public void bgrewriteaof() {
|
||||||
sendCommand("BGREWRITEAOF");
|
sendCommand("BGREWRITEAOF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void lastsave() {
|
||||||
|
sendCommand("LASTSAVE");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -617,4 +617,9 @@ public class Jedis {
|
|||||||
client.bgrewriteaof();
|
client.bgrewriteaof();
|
||||||
return client.getStatusCodeReply();
|
return client.getStatusCodeReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int lastsave() {
|
||||||
|
client.lastsave();
|
||||||
|
return client.getIntegerReply();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@ package redis.clients.jedis.tests.commands;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import redis.clients.jedis.JedisException;
|
||||||
|
|
||||||
public class PersistenceControlCommandsTest extends JedisCommandTestBase {
|
public class PersistenceControlCommandsTest extends JedisCommandTestBase {
|
||||||
@Test
|
@Test
|
||||||
public void save() {
|
public void save() {
|
||||||
@@ -21,4 +23,19 @@ public class PersistenceControlCommandsTest extends JedisCommandTestBase {
|
|||||||
assertEquals("Background append only file rewriting started", status);
|
assertEquals("Background append only file rewriting started", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void lastsave() throws InterruptedException {
|
||||||
|
int before = jedis.lastsave();
|
||||||
|
String st = "";
|
||||||
|
while (!st.equals("OK")) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
st = jedis.save();
|
||||||
|
} catch (JedisException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int after = jedis.lastsave();
|
||||||
|
assertTrue((after - before) > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user