@@ -104,21 +104,21 @@ public static int getTxCommitMemory(FluoConfiguration conf) {
104104 return m ;
105105 }
106106
107- public static final String TX_INFO_CACHE_SIZE = FLUO_IMPL_PREFIX + ".tx.failed.cache.size .mb" ;
108- public static final long TX_INFO_CACHE_SIZE_DEFAULT = 10_000_000 ;
107+ public static final String TX_INFO_CACHE_WEIGHT = FLUO_IMPL_PREFIX + ".tx.failed.cache.weight .mb" ;
108+ public static final long TX_INFO_CACHE_WEIGHT_DEFAULT = 10_000_000 ;
109109
110110 /**
111- * Gets the cache size
111+ * Gets the txinfo cache weight
112112 *
113113 * @param conf The FluoConfiguration
114- * @return The size of the cache value from the property value {@value #TX_INFO_CACHE_SIZE }
115- * if it is set, else the value of the default value {@value #TX_INFO_CACHE_SIZE_DEFAULT }
114+ * @return The size of the cache value from the property value {@value #TX_INFO_CACHE_WEIGHT }
115+ * if it is set, else the value of the default value {@value #TX_INFO_CACHE_WEIGHT_DEFAULT }
116116 */
117117
118- public static long getTxInfoCacheSize (FluoConfiguration conf ) {
119- long size = conf .getLong (TX_INFO_CACHE_SIZE , TX_INFO_CACHE_SIZE_DEFAULT );
118+ public static long getTxInfoCacheWeight (FluoConfiguration conf ) {
119+ long size = conf .getLong (TX_INFO_CACHE_WEIGHT , TX_INFO_CACHE_WEIGHT_DEFAULT );
120120 if (size <= 0 ) {
121- throw new IllegalArgumentException ("Cache size must be positive for " + TX_INFO_CACHE_SIZE );
121+ throw new IllegalArgumentException ("Cache size must be positive for " + TX_INFO_CACHE_WEIGHT );
122122 }
123123 return size ;
124124 }
@@ -144,22 +144,23 @@ public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) {
144144 return tu .convert (millis , TimeUnit .MILLISECONDS );
145145 }
146146
147- public static final String VISIBILITY_CACHE_SIZE = FLUO_IMPL_PREFIX + ".visibility.cache.size.mb" ;
148- public static final long VISIBILITY_CACHE_SIZE_DEFAULT = 10_000_000 ;
147+ public static final String VISIBILITY_CACHE_WEIGHT =
148+ FLUO_IMPL_PREFIX + ".visibility.cache.weight.mb" ;
149+ public static final long VISIBILITY_CACHE_WEIGHT_DEFAULT = 10_000_000 ;
149150
150151 /**
151- * Gets the cache size
152+ * Gets the visibility cache weight
152153 *
153154 * @param conf The FluoConfiguration
154- * @return The size of the cache value from the property value {@value #VISIBILITY_CACHE_SIZE }
155- * if it is set, else the value of the default value {@value #VISIBILITY_CACHE_SIZE_DEFAULT }
155+ * @return The size of the cache value from the property value {@value #VISIBILITY_CACHE_WEIGHT }
156+ * if it is set, else the value of the default value {@value #VISIBILITY_CACHE_WEIGHT_DEFAULT }
156157 */
157158
158- public static long getVisibilityCacheSize (FluoConfiguration conf ) {
159- long size = conf .getLong (VISIBILITY_CACHE_SIZE , VISIBILITY_CACHE_SIZE_DEFAULT );
159+ public static long getVisibilityCacheWeight (FluoConfiguration conf ) {
160+ long size = conf .getLong (VISIBILITY_CACHE_WEIGHT , VISIBILITY_CACHE_WEIGHT_DEFAULT );
160161 if (size <= 0 ) {
161162 throw new IllegalArgumentException (
162- "Cache size must be positive for " + VISIBILITY_CACHE_SIZE );
163+ "Cache size must be positive for " + VISIBILITY_CACHE_WEIGHT );
163164 }
164165 return size ;
165166 }
@@ -185,6 +186,41 @@ public static long getVisibilityCacheTimeout(FluoConfiguration conf, TimeUnit tu
185186 return tu .convert (millis , TimeUnit .MILLISECONDS );
186187 }
187188
189+ private static final String TRANSACTOR_MAX_CACHE_SIZE =
190+ FLUO_IMPL_PREFIX + ".transactor.cache.max.size" ;
191+ private static final long TRANSACTOR_MAX_CACHE_SIZE_DEFAULT = 32768 ; // this equals 2^15
192+
193+ /**
194+ * Gets the specified number of entries the cache can contain, this gets the value
195+ * of {@value #TRANSACTOR_MAX_CACHE_SIZE} if set, the default
196+ * {@value #TRANSACTOR_CACHE_TIMEOUT_DEFAULT} otherwise
197+ *
198+ * @param conf The FluoConfiguartion
199+ * @return The maximum number of entries permitted in this cache
200+ */
201+
202+ public static long getTransactorMaxCacheSize (FluoConfiguration conf ) {
203+ long size = conf .getLong (TRANSACTOR_MAX_CACHE_SIZE , TRANSACTOR_MAX_CACHE_SIZE_DEFAULT );
204+ if (size <= 0 ) {
205+ throw new IllegalArgumentException (
206+ "Cache size must be positive for " + TRANSACTOR_MAX_CACHE_SIZE );
207+ }
208+ return size ;
209+ }
210+
211+ public static final String TRANSACTOR_CACHE_TIMEOUT =
212+ FLUO_IMPL_PREFIX + ".transactor.cache.expireTime.ms" ;
213+
214+ public static final long TRANSACTOR_CACHE_TIMEOUT_DEFAULT = 24 * 60 * 1000 ;
215+
216+ public static long getTransactorCacheTimeout (FluoConfiguration conf , TimeUnit tu ) {
217+ long millis = conf .getLong (TRANSACTOR_CACHE_TIMEOUT , TRANSACTOR_CACHE_TIMEOUT_DEFAULT );
218+ if (millis <= 0 ) {
219+ throw new IllegalArgumentException ("Timeout must positive for " + TRANSACTOR_CACHE_TIMEOUT );
220+ }
221+ return tu .convert (millis , TimeUnit .MILLISECONDS );
222+ }
223+
188224 public static final String ASYNC_CW_THREADS = FLUO_IMPL_PREFIX + ".async.cw.threads" ;
189225 public static final int ASYNC_CW_THREADS_DEFAULT = 8 ;
190226 public static final String ASYNC_CW_LIMIT = FLUO_IMPL_PREFIX + ".async.cw.limit" ;
0 commit comments