Skip to content

Support ttl changes through write policy#136

Merged
tim-aero merged 8 commits intoaerospike:mainfrom
tim-aero:support-ttl-changes-through-write-policy
Jan 24, 2023
Merged

Support ttl changes through write policy#136
tim-aero merged 8 commits intoaerospike:mainfrom
tim-aero:support-ttl-changes-through-write-policy

Conversation

@tim-aero
Copy link
Contributor

@tim-aero tim-aero commented Jan 24, 2023

Resolves #132
3 main changes:

  1. If a WritePolicy is passed into the save method, the settings in it are respected. Hence the TTL and SendKey policy settings are not overridden but rather used from the passed policy.
  2. Defaulted the AerospkeRecord.ttl() to Integer.MIN_VALUE which effectively becomes "not set". Without this, a TTL set via a policy passed to the Builder() would never be respected.
  3. Added a unit test for the above.

- Added a unit test for LocalDateMapper and LocalDateTimeMapper
- Changed LocalDateMapper to use EpochDays
- Changed LocalDateTimeMapper to preserve full precision of the
LocalDateTime down the nanosecond level.
Added a mapper for LocalTime to round out Java 8 date / time classes.
Included a unit test for them.
Made 2 changes to the TTL behaviour:
1. If a WritePolicy is explicitly passed to the save method, the
settings in this policy are honoured, so neither the TTL nor the SendKey
will be altered.

2. Defaulted the AerospikeRecord.ttl() to Integer.MIN_VALUE and changed
the logic so this effectively becomes "not set". Without this change a
TTL set via an initial policy passed to the Builder (and not via the
AerospikeRecord annotation) would not be honoured under any
circumstances.
@tim-aero tim-aero requested a review from reugn January 24, 2023 01:28
@tim-aero tim-aero merged commit 2d09e74 into aerospike:main Jan 24, 2023
@nikmalviya
Copy link

Thanks! When can we expect a release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamically set TTL on an individual record

4 participants