Hervé Darritchon
Hervé Darritchon

Reputation: 471

Spring-Data Couchbase - How to set TTL to document?

I am using Spring-Data Couchbase project (1.1.1.RELEASE) over a Couchbase Cluster in version 2.2.

I need to set up some Time To Live properties on my documents.

I know how to do it with CouchbaseClient object but I don't know how to do it using Spring-Data Couchbase abstraction.

Thanks for your help.

Upvotes: 3

Views: 2229

Answers (1)

Paddy
Paddy

Reputation: 1195

To set a TTL you set the expiry value on the document:

@Document(expiry = 10)

This will set the TTL to 10 seconds. The Spring-Data Couchbase reference guide covers this in more details.

Upvotes: 1

Related Questions