use of io.jans.orm.couchbase.impl.CouchbaseEntryManager in project jans by JanssenProject.
the class ManualCouchbaseEntryManagerTest method sampleSessionId.
// manual
@Test(enabled = false)
public void sampleSessionId() throws IOException, SearchException {
CouchbaseEntryManager manager = createCouchbaseEntryManager();
try {
SessionId sessionId = createSessionId();
manager.persist(sessionId);
final String key = "sessions_" + sessionId.getId();
System.out.println("Key: " + key + ", ttl:" + sessionId.getTtl());
Bucket sessionBucket = manager.getOperationService().getConnectionProvider().getBucketMapping("sessions").getBucket();
final JsonDocument lookup = sessionBucket.get(key);
System.out.println("expiry: " + lookup.expiry());
DocumentFragment<Lookup> ttl = sessionBucket.lookupIn(key).get("$document.exptime", new SubdocOptionsBuilder().xattr(true)).execute();
System.out.println("ttl: " + ttl.content("$document.exptime"));
updateSession(sessionId);
manager.merge(sessionId);
final JsonDocument lookup2 = manager.getOperationService().getConnectionProvider().getBucketMapping("sessions").getBucket().get(key);
System.out.println("expiry after update: " + lookup2.expiry());
} finally {
manager.destroy();
}
}
Aggregations