mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-12 22:29:41 +08:00
Make Cache dir configurable
Reviewed By: davidaurelio Differential Revision: D2811278 fb-gh-sync-id: 77c03a8f806135fff56914bac60c156d10b05ea4
This commit is contained in:
committed by
facebook-github-bot-4
parent
b84ad2ab0d
commit
83ddd74ac7
@@ -13,7 +13,7 @@ const fs = require('fs');
|
||||
const getCacheFilePath = require('./lib/getCacheFilePath');
|
||||
const isAbsolutePath = require('absolute-path');
|
||||
const loadCacheSync = require('./lib/loadCacheSync');
|
||||
const tmpdir = require('os').tmpDir();
|
||||
const tmpDir = require('os').tmpDir();
|
||||
|
||||
function getObjectValues(object) {
|
||||
return Object.keys(object).map(key => object[key]);
|
||||
@@ -31,8 +31,9 @@ class Cache {
|
||||
constructor({
|
||||
resetCache,
|
||||
cacheKey,
|
||||
cacheDirectory = tmpDir,
|
||||
}) {
|
||||
this._cacheFilePath = getCacheFilePath(tmpdir, cacheKey);
|
||||
this._cacheFilePath = getCacheFilePath(cacheDirectory, cacheKey);
|
||||
if (!resetCache) {
|
||||
this._data = this._loadCacheSync(this._cacheFilePath);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user