mirror of
https://github.com/status-im/metro.git
synced 2025-01-23 01:19:04 +00:00
Make Cache dir configurable
Reviewed By: davidaurelio Differential Revision: D2811278 fb-gh-sync-id: 77c03a8f806135fff56914bac60c156d10b05ea4
This commit is contained in:
parent
c2dcb04d29
commit
c75610febb
@ -13,7 +13,7 @@ const fs = require('fs');
|
|||||||
const getCacheFilePath = require('./lib/getCacheFilePath');
|
const getCacheFilePath = require('./lib/getCacheFilePath');
|
||||||
const isAbsolutePath = require('absolute-path');
|
const isAbsolutePath = require('absolute-path');
|
||||||
const loadCacheSync = require('./lib/loadCacheSync');
|
const loadCacheSync = require('./lib/loadCacheSync');
|
||||||
const tmpdir = require('os').tmpDir();
|
const tmpDir = require('os').tmpDir();
|
||||||
|
|
||||||
function getObjectValues(object) {
|
function getObjectValues(object) {
|
||||||
return Object.keys(object).map(key => object[key]);
|
return Object.keys(object).map(key => object[key]);
|
||||||
@ -31,8 +31,9 @@ class Cache {
|
|||||||
constructor({
|
constructor({
|
||||||
resetCache,
|
resetCache,
|
||||||
cacheKey,
|
cacheKey,
|
||||||
|
cacheDirectory = tmpDir,
|
||||||
}) {
|
}) {
|
||||||
this._cacheFilePath = getCacheFilePath(tmpdir, cacheKey);
|
this._cacheFilePath = getCacheFilePath(cacheDirectory, cacheKey);
|
||||||
if (!resetCache) {
|
if (!resetCache) {
|
||||||
this._data = this._loadCacheSync(this._cacheFilePath);
|
this._data = this._loadCacheSync(this._cacheFilePath);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user