Skip to content

Commit 29fdac5

Browse files
committed
Remove try...catch in GetValueOrCreateAsync
1 parent fbbc614 commit 29fdac5

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Enyim.Caching/MemcachedClient.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,11 @@ public async Task<T> GetValueAsync<T>(string key)
214214

215215
public async Task<T> GetValueOrCreateAsync<T>(string key, int cacheSeconds, Func<Task<T>> generator)
216216
{
217-
try
218-
{
219-
var result = await GetAsync<T>(key);
220-
if (result.Success)
221-
{
222-
_logger.LogDebug($"Cache is hint. Key is '{key}'.");
223-
return result.Value;
224-
}
225-
}
226-
catch (Exception ex)
217+
var result = await GetAsync<T>(key);
218+
if (result.Success)
227219
{
228-
_logger.LogError(ex, $"{nameof(GetAsync)}<{typeof(T)}>(\"{key}\")");
220+
_logger.LogDebug($"Cache is hint. Key is '{key}'.");
221+
return result.Value;
229222
}
230223

231224
_logger.LogDebug($"Cache is missed. Key is '{key}'.");

0 commit comments

Comments
 (0)