public static async Task <string> GetString(this IKeyValueCache cache, string key) { var bytes = await cache.GetBytes(key); var str = Encoding.UTF8.GetString(bytes); return(str); }
public static async Task <byte[]> TryGetBytes(this IKeyValueCache cache, string key) { try { var bytes = await cache.GetBytes(key); return(bytes); } catch { return(null); } }