You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
661 B

4 years ago
  1. 'use strict'
  2. const BB = require('bluebird')
  3. const index = require('./lib/entry-index')
  4. const memo = require('./lib/memoization')
  5. const path = require('path')
  6. const rimraf = BB.promisify(require('rimraf'))
  7. const rmContent = require('./lib/content/rm')
  8. module.exports = entry
  9. module.exports.entry = entry
  10. function entry (cache, key) {
  11. memo.clearMemoized()
  12. return index.delete(cache, key)
  13. }
  14. module.exports.content = content
  15. function content (cache, integrity) {
  16. memo.clearMemoized()
  17. return rmContent(cache, integrity)
  18. }
  19. module.exports.all = all
  20. function all (cache) {
  21. memo.clearMemoized()
  22. return rimraf(path.join(cache, '*(content-*|index-*)'))
  23. }