/// <summary> /// Handles the prefix of CacheKey. /// </summary> /// <param name="prefix">Prefix of CacheKey.</param> /// <exception cref="ArgumentException"></exception> private string HandlePrefix(string prefix) { // Forbid if (prefix.Equals("*")) { throw new ArgumentException("the prefix should not equal to *"); } // Don't start with * prefix = new System.Text.RegularExpressions.Regex("^\\*+").Replace(prefix, ""); // End with * if (!prefix.EndsWith("*", StringComparison.OrdinalIgnoreCase)) { prefix = string.Concat(prefix, "*"); } return(prefix); }