MCPcopy
hub / github.com/caddyserver/caddy / DeleteN

Method DeleteN

caddyconfig/caddyfile/dispenser.go:465–471  ·  view source on GitHub ↗

DeleteN is the same as Delete, but can delete many tokens at once. If there aren't N tokens available to delete, none are deleted.

(amount int)

Source from the content-addressed store, hash-verified

463// DeleteN is the same as Delete, but can delete many tokens at once.
464// If there aren't N tokens available to delete, none are deleted.
465func (d *Dispenser) DeleteN(amount int) []Token {
466 if amount > 0 && d.cursor >= (amount-1) && d.cursor <= len(d.tokens)-1 {
467 d.tokens = append(d.tokens[:d.cursor-(amount-1)], d.tokens[d.cursor+1:]...)
468 d.cursor -= amount
469 }
470 return d.tokens
471}
472
473// SetContext sets a key-value pair in the context map.
474func (d *Dispenser) SetContext(key string, value any) {

Callers 2

parseCaddyfileFunction · 0.80
parsePHPFastCGIFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected