@@ -114,6 +114,8 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean {
114114 private final Property <String > alias ;
115115 private final Property <String > encoderBase ;
116116
117+ private final Property <Boolean > bypassAddOpt ;
118+
117119 EVCacheImpl (String appName , String cacheName , int timeToLive , Transcoder <?> transcoder , boolean enableZoneFallback ,
118120 boolean throwException , EVCacheClientPoolManager poolManager ) {
119121 this ._appName = appName ;
@@ -170,6 +172,9 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean {
170172 // auto key prepend with appname for duet feature.
171173 this .maxKeyLength = propertyRepository .get (_appName + ".max.key.length" , Integer .class ).orElseGet ("evcache.max.key.length" ).orElse (200 );
172174
175+ // bypass short-circuit optimization
176+ this .bypassAddOpt = propertyRepository .get (_appName + ".bypass.add.opt" , Boolean .class ).orElse (false );
177+
173178 // if alias changes, refresh my pool to point to the correct alias app
174179 this .alias = propertyRepository .get ("EVCacheClientPoolManager." + appName + ".alias" , String .class );
175180 this .alias .subscribe (i -> {
@@ -3322,7 +3327,7 @@ protected <T> EVCacheLatch add(String key, T value, Transcoder<T> tc, int timeTo
33223327 cd = _pool .getEVCacheClientForRead ().getTranscoder ().encode (value );
33233328 }
33243329 if (clientUtil == null ) clientUtil = new EVCacheClientUtil (_appName , _pool .getOperationTimeout ().get ());
3325- latch = clientUtil .add (evcKey , cd , evcacheValueTranscoder , timeToLive , policy , clients , latchCount , fixup );
3330+ latch = clientUtil .add (evcKey , cd , evcacheValueTranscoder , timeToLive , policy , clients , latchCount , fixup , bypassAddOpt . get () );
33263331 if (event != null ) {
33273332 event .setTTL (timeToLive );
33283333 event .setCachedData (cd );
0 commit comments