Example #1
0
        public IActionResult BatchDeleteKeysByQuery([FromQuery] string pattern)
        {
            try
            {
                var res = _keysService.BatchDeleteKeysByQuery(pattern);

                if (res == 0)
                {
                    var errMessage = new { success = res, message = "Keys matching pattern do not exist" };

                    return(NotFound(errMessage));
                }

                var deletedKeys = $"{res}";

                var message = new { success = res, message = $"Successfully deleted {pattern}" };

                return(Ok(message));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }