@@ -105,7 +105,7 @@ public static int getTxCommitMemory(FluoConfiguration conf) {
105
105
}
106
106
107
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 = 10000000 ;
108
+ public static final long TX_INFO_CACHE_SIZE_DEFAULT = 10_000_000 ;
109
109
110
110
/**
111
111
* Gets the cache size
@@ -144,6 +144,47 @@ public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) {
144
144
return tu .convert (millis , TimeUnit .MILLISECONDS );
145
145
}
146
146
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 ;
149
+
150
+ /**
151
+ * Gets the cache size
152
+ *
153
+ * @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}
156
+ */
157
+
158
+ public static long getVisibilityCacheSize (FluoConfiguration conf ) {
159
+ long size = conf .getLong (VISIBILITY_CACHE_SIZE , VISIBILITY_CACHE_SIZE_DEFAULT );
160
+ if (size <= 0 ) {
161
+ throw new IllegalArgumentException (
162
+ "Cache size must be positive for " + VISIBILITY_CACHE_SIZE );
163
+ }
164
+ return size ;
165
+ }
166
+
167
+ public static final String VISIBILITY_CACHE_TIMEOUT =
168
+ FLUO_IMPL_PREFIX + ".visibility.cache.expireTime.ms" ;
169
+ public static final long VISIBILITY_CACHE_TIMEOUT_DEFAULT = 24 * 60 * 1000 ;
170
+
171
+ /**
172
+ * Gets the time before stale entries in the cache are evicted based on age.
173
+ * This method returns a long representing the time converted from the
174
+ * TimeUnit passed in.
175
+ *
176
+ * @param conf The FluoConfiguration
177
+ * @param tu The TimeUnit desired to represent the cache timeout
178
+ */
179
+
180
+ public static long getVisibilityCacheTimeout (FluoConfiguration conf , TimeUnit tu ) {
181
+ long millis = conf .getLong (VISIBILITY_CACHE_TIMEOUT , VISIBILITY_CACHE_TIMEOUT_DEFAULT );
182
+ if (millis <= 0 ) {
183
+ throw new IllegalArgumentException ("Timeout must positive for " + VISIBILITY_CACHE_TIMEOUT );
184
+ }
185
+ return tu .convert (millis , TimeUnit .MILLISECONDS );
186
+ }
187
+
147
188
public static final String ASYNC_CW_THREADS = FLUO_IMPL_PREFIX + ".async.cw.threads" ;
148
189
public static final int ASYNC_CW_THREADS_DEFAULT = 8 ;
149
190
public static final String ASYNC_CW_LIMIT = FLUO_IMPL_PREFIX + ".async.cw.limit" ;
0 commit comments