pub enum When {
Always,
Unset,
AlreadySet,
Later,
Earlier,
EarlierAndAlreadySet,
}Expand description
Whether a deadline is allowed to move, which is EXPIRE’s NX, XX, GT
and LT.
The condition is checked before the moment is, so a deadline that has already gone and a condition that says no leaves the key alone rather than deleting it.
Variants§
Always
Whatever is there now. Plain EXPIRE.
Unset
Only if the key has no deadline yet. NX.
AlreadySet
Only if it already has one. XX.
Later
Only if this pushes the deadline further out. GT.
A key with no deadline is refused, because no deadline reads as infinitely far away and nothing is further out than that.
Earlier
Only if this brings the deadline in. LT.
A key with no deadline is accepted, by the same reading.
EarlierAndAlreadySet
Only if there is one now and this brings it in. XX LT.
The one combination the other five cannot say. XX GT is just GT,
since GT already refuses a key with no deadline.