Api change request for touch and getAndTouch on Reactive Collection of Java SDK 3.1

Hi Guys,

I think in the API below,

public Mono touch(final String id, final Duration expiry, final TouchOptions options)

Duration expiry should be moved inside TouchOptions so that you can support both Instant and Duration based variations. The same applies to the getAndTouch APIs as well. Follows the UpsertOptions pattern.

I was wondering how to touch a document for 3 months without pain.


Hi @Neome_Web

Well the logic there is that with touch you have to supply an expiration time, so it’s not an optional argument and therefore shouldn’t go in the options structure.
What could be an option, is to add an Instant-based overload for touch and getAndTouch. Let me discuss with the team and get back to you.

Hi @Neome_Web,
I’ve discussed with the JVM team, and we agree with you that having a way to do getAndTouch with Instant would be more consistent with the Options block variants, and would give a value add. But weighed against this, is that we’re reluctant to add overloads to the API where it can be helped, and that it’s very easy to create an appropriate Duration from an Instant with e.g.:

Duration expiryDuration = Duration.between(Instant.now(), expiryInstant);

So, for now, I’m going to file a docs ticket to get this added to the documentation, and we will monitor the community for further feedback on this issue.