Make Cache dir configurable

Reviewed By: davidaurelio

Differential Revision: D2811278

fb-gh-sync-id: 77c03a8f806135fff56914bac60c156d10b05ea4
This commit is contained in:
Christoph Pojer
2016-01-08 06:55:38 -08:00
committed by facebook-github-bot-4
parent b84ad2ab0d
commit 83ddd74ac7

View File

@@ -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 {