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