import { CacheProvider , CacheStorageKey } from '@discordoo/providers' ; export async function cacheProviderSweepPolyfill < K = string , V = any , P extends CacheProvider = CacheProvider > ( provider , keyspace , storage , predicate ) { const keys = [ ] ; await provider . forEach < K , V > ( keyspace , storage , async ( value , key ) => { if ( await predicate ( value , key , provider ) ) { keys . push ( key ) ; } } ) ; if ( keys . length ) { return provider . delete < K > ( keyspace , storage , keys ) ; } return true ; }