Skip to content

Commit

Permalink
Move destroy method to AssetCache
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Oct 23, 2024
1 parent bf70fa0 commit 4ca49c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 15 additions & 0 deletions src/AssetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,20 @@ class AssetCache {

return this.source;
}

// for testing
hasCacheFiles() {
return fs.existsSync(this.cachePath) || fs.existsSync(this.getCachedContentsPath());
}

// for testing
async destroy() {
if (fs.existsSync(this.cachePath)) {
await fsp.unlink(this.cachePath);
}
if (fs.existsSync(this.getCachedContentsPath())) {
await fsp.unlink(this.getCachedContentsPath());
}
}
}
module.exports = AssetCache;
15 changes: 0 additions & 15 deletions src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,5 @@ class RemoteAssetCache extends AssetCache {
}
}
}

// for testing
hasCacheFiles() {
return fs.existsSync(this.cachePath) || fs.existsSync(this.getCachedContentsPath());
}

// for testing
async destroy() {
if (fs.existsSync(this.cachePath)) {
await fsp.unlink(this.cachePath);
}
if (fs.existsSync(this.getCachedContentsPath())) {
await fsp.unlink(this.getCachedContentsPath());
}
}
}
module.exports = RemoteAssetCache;

0 comments on commit 4ca49c7

Please sign in to comment.