MCPcopy
hub / github.com/aquasecurity/trivy / Clear

Method Clear

pkg/cache/redis.go:217–231  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

215}
216
217func (c RedisCache) Clear(ctx context.Context) error {
218 for {
219 keys, cursor, err := c.client.Scan(ctx, 0, redisPrefix+"::*", 100).Result()
220 if err != nil {
221 return xerrors.Errorf("failed to perform prefix scanning: %w", err)
222 }
223 if err = c.client.Unlink(ctx, keys...).Err(); err != nil {
224 return xerrors.Errorf("failed to unlink redis keys: %w", err)
225 }
226 if cursor == 0 { // We cleared all keys
227 break
228 }
229 }
230 return nil
231}
232
233// GetTLSConfig gets tls config from CA, Cert and Key file
234func GetTLSConfig(caCertPath, certPath, keyPath string) (*x509.CertPool, tls.Certificate, error) {

Callers 1

TestRedisCache_ClearFunction · 0.95

Calls 2

ScanMethod · 0.65
ErrMethod · 0.45

Tested by 1

TestRedisCache_ClearFunction · 0.76