Exemple #1
0
        public void EmptyTest()
        {
            //Saves the cache and pass it a timespan for expiration
            barrel.Add(key: url, data: monkeys, expireIn: TimeSpan.FromDays(1));


            var cached = barrel.Get <IEnumerable <Monkey> >(url);

            Assert.IsNotNull(cached);

            barrel.Empty(url);

            cached = barrel.Get <IEnumerable <Monkey> >(url);

            Assert.IsNull(cached);
        }
        public Task <bool> Remove(string key, CancellationToken cancellationToken = default)
        {
            try
            {
                _barrel.Empty(key);

                return(Task.FromResult(true));
            }
            catch (Exception)
            {
                return(Task.FromResult(false));
            }
        }