11cb0ef41Sopenharmony_ci'use strict' 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst { rm } = require('fs/promises') 41cb0ef41Sopenharmony_ciconst glob = require('./util/glob.js') 51cb0ef41Sopenharmony_ciconst index = require('./entry-index') 61cb0ef41Sopenharmony_ciconst memo = require('./memoization') 71cb0ef41Sopenharmony_ciconst path = require('path') 81cb0ef41Sopenharmony_ciconst rmContent = require('./content/rm') 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cimodule.exports = entry 111cb0ef41Sopenharmony_cimodule.exports.entry = entry 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cifunction entry (cache, key, opts) { 141cb0ef41Sopenharmony_ci memo.clearMemoized() 151cb0ef41Sopenharmony_ci return index.delete(cache, key, opts) 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cimodule.exports.content = content 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cifunction content (cache, integrity) { 211cb0ef41Sopenharmony_ci memo.clearMemoized() 221cb0ef41Sopenharmony_ci return rmContent(cache, integrity) 231cb0ef41Sopenharmony_ci} 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_cimodule.exports.all = all 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciasync function all (cache) { 281cb0ef41Sopenharmony_ci memo.clearMemoized() 291cb0ef41Sopenharmony_ci const paths = await glob(path.join(cache, '*(content-*|index-*)'), { silent: true, nosort: true }) 301cb0ef41Sopenharmony_ci return Promise.all(paths.map((p) => rm(p, { recursive: true, force: true }))) 311cb0ef41Sopenharmony_ci} 32