/// <summary>
        /// Gets a trimmable view on the specified memoization <paramref name="cache"/>, exposing the memoized function's cache entry metrics.
        /// </summary>
        /// <param name="cache">The memoization cache to obtain a trimmable view for.</param>
        /// <returns>A trimmable view on the specified memoization <paramref name="cache"/> if the cache supports trimming; otherwise, null.</returns>
        public static ITrimmable <IMemoizationCacheEntryMetrics> AsTrimmableByMetrics(this IMemoizationCache cache)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            return(cache.GetService <ITrimmable <IMemoizationCacheEntryMetrics> >());
        }
        /// <summary>
        /// Gets a trimmable view on the specified memoization <paramref name="cache"/>, exposing the memoized function's pairs of arguments and results or errors.
        /// </summary>
        /// <typeparam name="T">The type of the memoized function's arguments.</typeparam>
        /// <typeparam name="TResult">The type of the memoized function's result.</typeparam>
        /// <param name="cache">The memoization cache to obtain a trimmable view for.</param>
        /// <returns>A trimmable view on the specified memoization <paramref name="cache"/> if the cache supports trimming; otherwise, null.</returns>
        public static ITrimmable <KeyValuePair <T, IValueOrError <TResult> > > AsTrimmableByArgumentAndResultOrError <T, TResult>(this IMemoizationCache <T, TResult> cache)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            return(cache.GetService <ITrimmable <KeyValuePair <T, IValueOrError <TResult> > > >());
        }