MCPcopy
hub / github.com/caddyserver/certmagic / RemoveManaged

Method RemoveManaged

cache.go:411–425  ·  view source on GitHub ↗

RemoveManaged removes managed certificates for the given subjects from the cache. This effectively stops maintenance of those certificates. If an IssuerKey is specified alongside the subject, only certificates for that subject from the specified issuer will be removed.

(subjects []SubjectIssuer)

Source from the content-addressed store, hash-verified

409// specified alongside the subject, only certificates for that subject from the
410// specified issuer will be removed.
411func (certCache *Cache) RemoveManaged(subjects []SubjectIssuer) {
412 deleteQueue := make([]string, 0, len(subjects))
413 for _, subj := range subjects {
414 certs := certCache.getAllMatchingCerts(subj.Subject) // does NOT expand wildcards; exact matches only
415 for _, cert := range certs {
416 if !cert.managed {
417 continue
418 }
419 if subj.IssuerKey == "" || cert.issuerKey == subj.IssuerKey {
420 deleteQueue = append(deleteQueue, cert.hash)
421 }
422 }
423 }
424 certCache.Remove(deleteQueue)
425}
426
427// Remove removes certificates with the given hashes from the cache.
428// This is effectively used to unload manually-loaded certificates.

Callers

nothing calls this directly

Calls 2

getAllMatchingCertsMethod · 0.95
RemoveMethod · 0.95

Tested by

no test coverage detected