@@ -274,7 +274,7 @@ void CopyRespToWithInput(ref RawStringInput input, ref SpanByte value, ref SpanB
274274 }
275275 }
276276
277- bool EvaluateExpireInPlace ( ExpireOption optionType , bool expiryExists , long newExpiry , ref SpanByte value , ref SpanByteAndMemory output )
277+ IPUResult EvaluateExpireInPlace ( ExpireOption optionType , bool expiryExists , long newExpiry , ref SpanByte value , ref SpanByteAndMemory output )
278278 {
279279 ObjectOutputHeader * o = ( ObjectOutputHeader * ) output . SpanByte . ToPointer ( ) ;
280280 if ( expiryExists )
@@ -291,26 +291,26 @@ bool EvaluateExpireInPlace(ExpireOption optionType, bool expiryExists, long newE
291291 break ;
292292 case ExpireOption . GT :
293293 case ExpireOption . XXGT :
294- var replace = newExpiry < value . ExtraMetadata ;
295- value . ExtraMetadata = replace ? value . ExtraMetadata : newExpiry ;
294+ var replace = newExpiry > value . ExtraMetadata ;
295+ if ( replace ) value . ExtraMetadata = newExpiry ;
296296 if ( replace )
297- o ->result1 = 0 ;
298- else
299297 o ->result1 = 1 ;
298+ else
299+ o ->result1 = 0 ;
300300 break ;
301301 case ExpireOption . LT :
302302 case ExpireOption . XXLT :
303- replace = newExpiry > value . ExtraMetadata ;
304- value . ExtraMetadata = replace ? value . ExtraMetadata : newExpiry ;
303+ replace = newExpiry < value . ExtraMetadata ;
304+ if ( replace ) value . ExtraMetadata = newExpiry ;
305305 if ( replace )
306- o ->result1 = 0 ;
307- else
308306 o ->result1 = 1 ;
307+ else
308+ o ->result1 = 0 ;
309309 break ;
310310 default :
311311 throw new GarnetException ( $ "EvaluateExpireInPlace exception expiryExists:{ expiryExists } , optionType{ optionType } ") ;
312312 }
313- return true ;
313+ return o -> result1 == 1 ? IPUResult . Succeeded : IPUResult . NotUpdated ;
314314 }
315315 else
316316 {
@@ -319,13 +319,13 @@ bool EvaluateExpireInPlace(ExpireOption optionType, bool expiryExists, long newE
319319 case ExpireOption . NX :
320320 case ExpireOption . None :
321321 case ExpireOption . LT : // If expiry doesn't exist, LT should treat the current expiration as infinite
322- return false ;
322+ return IPUResult . Failed ;
323323 case ExpireOption . XX :
324324 case ExpireOption . GT :
325325 case ExpireOption . XXGT :
326326 case ExpireOption . XXLT :
327327 o ->result1 = 0 ;
328- return true ;
328+ return IPUResult . NotUpdated ;
329329 default :
330330 throw new GarnetException ( $ "EvaluateExpireInPlace exception expiryExists:{ expiryExists } , optionType{ optionType } ") ;
331331 }
0 commit comments