diff --git a/src/node/utils/caching_middleware.js b/src/node/utils/caching_middleware.js index bfe6a6be2..1f5336733 100644 --- a/src/node/utils/caching_middleware.js +++ b/src/node/utils/caching_middleware.js @@ -21,9 +21,12 @@ var path = require('path'); var zlib = require('zlib'); var util = require('util'); var settings = require('./Settings'); +var semver = require('semver'); + +var existsSync = (semver.satisfies(process.version, '>=0.8.0')) ? fs.existsSync : path.existsSync var CACHE_DIR = path.normalize(path.join(settings.root, 'var/')); -CACHE_DIR = fs.existsSync(CACHE_DIR) ? CACHE_DIR : undefined; +CACHE_DIR = existsSync(CACHE_DIR) ? CACHE_DIR : undefined; var responseCache = {};