public static async Task <TEntity> GetAsync <TEntity>(this Abstractions.IDistributedCache cache, string key)
        {
            TEntity result = default;

            var binary = await cache.GetAsync(key);

            if (binary != null)
            {
                result = binary.Deserialize <TEntity>();
            }

            return(result);
        }
        public static async Task <TEntity> GetOrCreateAsync <TEntity>(this Abstractions.IDistributedCache cache, string key, Func <Task <TEntity> > predicate, int ttl)
        {
            TEntity entity = await cache.GetAsync <TEntity>(key);

            if (entity != null)
            {
                return(entity);
            }

            entity = await predicate();

            await cache.SetAsync(key, entity, ttl);

            return(entity);
        }