Set TTL for vertex

Can i set TTL for vertex after running janusgraph about 4 months?
Solution:
From https://docs.janusgraph.org/schema/advschema/#vertex-ttl :
mgmt = graph.openManagement()
tweet = mgmt.makeVertexLabel('tweet').setStatic().make()
mgmt.setTTL(tweet, Duration.ofHours(36))
mgmt.commit()
mgmt = graph.openManagement()
tweet = mgmt.makeVertexLabel('tweet').setStatic().make()
mgmt.setTTL(tweet, Duration.ofHours(36))
mgmt.commit()
...
Jump to solution
6 Replies
Solution
Volker
Volker17mo ago
From https://docs.janusgraph.org/schema/advschema/#vertex-ttl :
mgmt = graph.openManagement()
tweet = mgmt.makeVertexLabel('tweet').setStatic().make()
mgmt.setTTL(tweet, Duration.ofHours(36))
mgmt.commit()
mgmt = graph.openManagement()
tweet = mgmt.makeVertexLabel('tweet').setStatic().make()
mgmt.setTTL(tweet, Duration.ofHours(36))
mgmt.commit()
Dinh Phu
Dinh Phu17mo ago
if that vertexlabel already exists, what to do
Volker
Volker17mo ago
mgmt.getVertexLabel('tweet').setTTL(...)
mgmt.getVertexLabel('tweet').setTTL(...)
Dinh Phu
Dinh Phu17mo ago
thank
Volker
Volker17mo ago
you are welcome, but keep in mind that it can take some time to actually propagate the TTL changes in janusgraph and only
CQL, HBase and BerkeleyDB
CQL, HBase and BerkeleyDB
support TTL atm
Dinh Phu
Dinh Phu17mo ago
yes, fortunately i' m using Hbase