Skip to content

Add Key-Level TTL Support #153

Answered by dario-vega
otaviojava asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an example using the Java SDK and the put API

import oracle.nosql.driver.TimeToLive;

MapValue value = new MapValue()
    .put("id", "1")
    .put("entity", "person")
    .putFromJson("content", "{\"name\":\"Lucas\",\"location\":\"BR\",\"type\":\"V\",\"age\":22}", null);

PutRequest putRequest = new PutRequest()
    .setValue(value)
    .setTTL(TimeToLive.ofHours(2)) 
    //.setTTL(TimeToLive.ofDays(2))
    .setTableName(tableName);

Retrieving the expiration time using the Java SDK and the get API

MapValue key = new MapValue().put("id", "1");
GetRequest getRequest = new GetRequest()
    .setKey(key)
    .setTableName(tableName);
GetResult getRes = serviceHandle.get(getRequest);
l…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by otaviojava
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment