Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Instant in doc.getExpiration() for Long-Term Expiry #2006

Open
Divya-1200 opened this issue Nov 17, 2024 · 0 comments
Open

Support for Instant in doc.getExpiration() for Long-Term Expiry #2006

Divya-1200 opened this issue Nov 17, 2024 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@Divya-1200
Copy link

I noticed that in the buildUpsertOptions and
buildInsertOptions methods, the doc.getExpiration() value is always converted to seconds using Duration.ofSeconds().

else if (doc.getExpiration() != 0) {
    options.expiry(Duration.ofSeconds(doc.getExpiration()));
}

While options.expiry() can accept both Duration and Instant, converting the expiration exclusively to seconds can lead to limitations, especially for setting expirations greater than 50 years. This is because Couchbase supports durations up to 50 years when expressed as seconds, but longer durations must be provided as an Instant.

Suggestion

if (doc.getExpiration() > MAX_SECONDS_EXPIRATION) {  
    options.expiry(Instant.ofEpochSecond(doc.getExpiration()));  
} else {  
    options.expiry(Duration.ofSeconds(doc.getExpiration()));  
}

Does this approach align with the intended design of the buildUpsertOptions and buildInsertOptions methods, or are there other considerations that necessitate the current implementation?

Looking forward to your feedback and insights!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants