RocksDB: how to use ttl in java?
up vote
0
down vote
favorite
I am testing rocksdb for java api. I put a key-value entry into the map, and then wait for 20s, then get from map. Why the entry is not deleted?
this is my code:
import org.rocksdb.Options;
import org.rocksdb.RocksDBException;
import org.rocksdb.TtlDB;
public class Test2 {
public static void main(String args) throws Exception {
TtlDB.loadLibrary();
Options options = new Options()
.setCreateIfMissing(true);
TtlDB db = TtlDB.open(options, args[0],20,false);
if(args.length > 3 && "put".equals(args[1])) {
db.put(args[2].getBytes(), args[3].getBytes());
}
byte arr = db.get(args[2].getBytes());
if(arr != null) {
System.out.println(new String(arr));
} else {
System.out.println(arr);
}
System.out.println(db.get(args[2].getBytes()));
Thread.sleep(21000);
System.out.println(db.get(args[2].getBytes()));
db.close();
}
}
rocksdb
add a comment |
up vote
0
down vote
favorite
I am testing rocksdb for java api. I put a key-value entry into the map, and then wait for 20s, then get from map. Why the entry is not deleted?
this is my code:
import org.rocksdb.Options;
import org.rocksdb.RocksDBException;
import org.rocksdb.TtlDB;
public class Test2 {
public static void main(String args) throws Exception {
TtlDB.loadLibrary();
Options options = new Options()
.setCreateIfMissing(true);
TtlDB db = TtlDB.open(options, args[0],20,false);
if(args.length > 3 && "put".equals(args[1])) {
db.put(args[2].getBytes(), args[3].getBytes());
}
byte arr = db.get(args[2].getBytes());
if(arr != null) {
System.out.println(new String(arr));
} else {
System.out.println(arr);
}
System.out.println(db.get(args[2].getBytes()));
Thread.sleep(21000);
System.out.println(db.get(args[2].getBytes()));
db.close();
}
}
rocksdb
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am testing rocksdb for java api. I put a key-value entry into the map, and then wait for 20s, then get from map. Why the entry is not deleted?
this is my code:
import org.rocksdb.Options;
import org.rocksdb.RocksDBException;
import org.rocksdb.TtlDB;
public class Test2 {
public static void main(String args) throws Exception {
TtlDB.loadLibrary();
Options options = new Options()
.setCreateIfMissing(true);
TtlDB db = TtlDB.open(options, args[0],20,false);
if(args.length > 3 && "put".equals(args[1])) {
db.put(args[2].getBytes(), args[3].getBytes());
}
byte arr = db.get(args[2].getBytes());
if(arr != null) {
System.out.println(new String(arr));
} else {
System.out.println(arr);
}
System.out.println(db.get(args[2].getBytes()));
Thread.sleep(21000);
System.out.println(db.get(args[2].getBytes()));
db.close();
}
}
rocksdb
I am testing rocksdb for java api. I put a key-value entry into the map, and then wait for 20s, then get from map. Why the entry is not deleted?
this is my code:
import org.rocksdb.Options;
import org.rocksdb.RocksDBException;
import org.rocksdb.TtlDB;
public class Test2 {
public static void main(String args) throws Exception {
TtlDB.loadLibrary();
Options options = new Options()
.setCreateIfMissing(true);
TtlDB db = TtlDB.open(options, args[0],20,false);
if(args.length > 3 && "put".equals(args[1])) {
db.put(args[2].getBytes(), args[3].getBytes());
}
byte arr = db.get(args[2].getBytes());
if(arr != null) {
System.out.println(new String(arr));
} else {
System.out.println(arr);
}
System.out.println(db.get(args[2].getBytes()));
Thread.sleep(21000);
System.out.println(db.get(args[2].getBytes()));
db.close();
}
}
rocksdb
rocksdb
asked Nov 20 at 7:33
Z.Lun
3219
3219
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Expired TTL values are deleted in compaction only:(Timestamp + ttl < time_now)
https://github.com/facebook/rocksdb/wiki/Time-to-Live
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Expired TTL values are deleted in compaction only:(Timestamp + ttl < time_now)
https://github.com/facebook/rocksdb/wiki/Time-to-Live
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
Expired TTL values are deleted in compaction only:(Timestamp + ttl < time_now)
https://github.com/facebook/rocksdb/wiki/Time-to-Live
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
up vote
0
down vote
Expired TTL values are deleted in compaction only:(Timestamp + ttl < time_now)
https://github.com/facebook/rocksdb/wiki/Time-to-Live
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Expired TTL values are deleted in compaction only:(Timestamp + ttl < time_now)
https://github.com/facebook/rocksdb/wiki/Time-to-Live
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered yesterday
D-kit
11
11
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
D-kit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388201%2frocksdb-how-to-use-ttl-in-java%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown