Created
August 29, 2019 22:00
-
-
Save ntakouris/9005c086bb9108c7e8a699490a020392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task CacheResponseAsync(string cacheKey, object response, TimeSpan timeTimeLive) | |
{ | |
if (response == null) | |
{ | |
return; | |
} | |
var serializedResponse = JsonConvert.SerializeObject(response); | |
await _distributedCache.SetStringAsync(cacheKey, serializedResponse, new DistributedCacheEntryOptions | |
{ | |
AbsoluteExpirationRelativeToNow = timeTimeLive | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment