Пример #1
0
        /// <summary>
        /// Adds an operation that purges content for a HAProxy frontend from the cache.
        /// </summary>
        /// <param name="frontendUri">
        /// The HAProxy frontend URI to be removed with optional <b>"*"</b> or <b>"**"</b> wildcards.
        /// </param>
        public void AddPurgeOrigin(string frontendUri)
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(frontendUri));

            if (!Uri.TryCreate(frontendUri, UriKind.Absolute, out var uri))
            {
                throw new ArgumentException($"[{frontendUri}] is not a valid URI.");
            }

            var globPattern = uri.PathAndQuery;

            GlobPattern.Parse(globPattern);    // This validates the pattern.

            PurgeOperations.Add(PurgeOperation.CreateOriginPurge(uri.Host, uri.Port, uri.PathAndQuery));
        }
Пример #2
0
 /// <summary>
 /// Adds an operation that purges all cached content.
 /// </summary>
 public void AddPurgeAll()
 {
     PurgeOperations.Add(PurgeOperation.CreatePurgeAll());
 }