MCPcopy
hub / github.com/saltstack/salt / flush

Function flush

salt/cache/redis_cache.py:401–426  ·  view source on GitHub ↗

Remove the key from the cache bank with all the key content. If no key is specified, remove the entire bank with all keys and sub-banks inside.

(bank, key=None)

Source from the content-addressed store, hash-verified

399
400
401def flush(bank, key=None):
402 """
403 Remove the key from the cache bank with all the key content. If no key is specified, remove
404 the entire bank with all keys and sub-banks inside.
405 """
406 try:
407 if key is None:
408 _flush_bank(bank)
409 else:
410 _flush_key(bank, key)
411 except (RedisConnectionError, RedisResponseError) as rerr:
412 bank_key, _ = _normalize_bank(bank)
413 if key is None:
414 mesg = "Cannot flush Redis cache bank {rbank}: {rerr}".format(
415 rbank=bank_key,
416 rerr=rerr,
417 )
418 else:
419 mesg = "Cannot flush Redis cache key {rbank}.{rkey}: {rerr}".format(
420 rbank=bank_key,
421 rkey=key,
422 rerr=rerr,
423 )
424 log.error(mesg)
425 raise SaltCacheError(mesg)
426 return True
427
428
429def list_(bank):

Callers

nothing calls this directly

Calls 6

SaltCacheErrorClass · 0.90
_flush_bankFunction · 0.85
_flush_keyFunction · 0.85
_normalize_bankFunction · 0.85
formatMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected