staleElementWrapper<T> function
T
staleElementWrapper<T>(
- MethodToRetry<
T> method, - ClearCacheMethod clear,
- IsStaleException isStaleException
Retries method
if an exception is thrown and isStaleException
is true
for said exception.
Implementation
T staleElementWrapper<T>(MethodToRetry<T> method, ClearCacheMethod clear,
IsStaleException isStaleException) {
try {
return method();
} catch (e) {
if (isStaleException(e)) {
clear();
return method();
}
rethrow;
}
}