Reputation: 5381
I have project with couchbase and using spring-data-couchbase. This has a document which i need to set expiry time using property file so that installation can configure this.
import org.springframework.data.couchbase.core.mapping.Document;
@Document(expiry = 60, touchOnRead = true)
public class SampleExpiryDoc {
How can i set above expiry time using property file ? Is there a simple way to do this ?
Upvotes: 1
Views: 1453
Reputation: 523
Please see this PR: https://github.com/spring-projects/spring-data-couchbase/pull/120 and unit tests as examples.
Basically, you can do it using @Document's "expiryExpression":
@Document(expiryExpression = "${document.expiry}")
public class MyDocument {
}
Upvotes: 2