0

I used the code below in my app to set the ttl for a document in CBL. If I am right, I think this ttl value will not be propagated to the couchbase server right?

So how can I set the ttl for the documents that are replicated from CBL to couchbase server, to make sure my server clean up the expired documents automatically? I can't find any documentation from Couchbase that could explain this clearly to me.

Date ttl = new Date(System.currentTimeMillis() + 86400000/2);
Document document = database.createDocument();
document.putProperties(properties);
document.setExpirationDate(ttl);
borrrden
  • 33,256
  • 8
  • 74
  • 109
Jack Liu
  • 43
  • 2
  • 9

1 Answers1

1

TTL in Lite is a separate thing from TTL on server. They have the same name but they are not related. Do not assume that server features are available from the mobile client because it is most likely not the case.

borrrden
  • 33,256
  • 8
  • 74
  • 109
  • but is there anyway to set a ttl for each document replicated to the server and have them removed automatically in the server? – Jack Liu Aug 19 '16 at 23:12
  • @JackLiu No, TTL is a different concept in server than it is in Lite. That's implementation details of Server that Lite doesn't concern itself with right now. I think there are possibly plans to do it in the future but nothing concrete, and probably not for version 1. – borrrden Aug 20 '16 at 00:31