public static CacheKey GetKey(DbCommand command, DbContext context, CachePolicy cachePolicy) { if (command is null) { throw new ArgumentNullException(nameof(command)); } if (cachePolicy is null) { throw new ArgumentNullException(nameof(cachePolicy)); } byte[] buffer = Encoding.UTF8.GetBytes(command.CommandText); var encodedString = Convert.ToBase64String(buffer); var cacheKey = GetCacheKey(command, cachePolicy.CacheSaltKey); var cacheKeyHash = $"{HashUtilities.ComputeHash(encodedString)}"; var cacheDependencies = GetCacheDependencies(command, context, cachePolicy); return(new CacheKey { Key = cacheKey, KeyHash = cacheKeyHash, CacheDependencies = cacheDependencies }); }