diff --git a/doc/api.markdown b/doc/api.markdown index 7469cbab6c7..7b95ab286ea 100644 --- a/doc/api.markdown +++ b/doc/api.markdown @@ -3243,6 +3243,10 @@ a directory. paths onto it, or at startup with the `NODE_PATH` environmental variable (which should be a list of paths, colon separated). +The second time `require('foo')` is called, it is not loaded again from +disk. It looks in the `require.cache` object to see if it has been loaded +before. + ## Addons diff --git a/src/node.js b/src/node.js index 6d53ea34250..187351839a4 100644 --- a/src/node.js +++ b/src/node.js @@ -268,6 +268,7 @@ var module = (function () { require.extensions = extensions; // TODO: Insert depreciation warning require.registerExtension = registerExtension; + require.cache = moduleCache; var dirname = path.dirname(filename);