|
try { |
|
self._fileCache[filePath] = self._fileCache[filePath] ? |
|
self._fileCache[filePath] : fs.readFileSync(filePath, 'utf8'); |
|
} catch (e) { |
Currently each Parser instance has its own cache. Each Page creates its own parser or markbinder instance and thus the cache is not shared. Considering there is a lot file reuse in Markbind, I feel we should have a common cache to cut down on the IO operations.
I propose having a static instance of file cache for Parser class. Possibly can abstract as its own module?
Things to consider
Not reading from cache when file is changed during live reload.
Related #88
markbind/lib/parser.js
Lines 73 to 76 in eed11dd
Currently each
Parserinstance has its own cache. EachPagecreates its ownparserormarkbinderinstance and thus the cache is not shared. Considering there is a lot file reuse inMarkbind, I feel we should have a common cache to cut down on the IO operations.I propose having a static instance of file cache for
Parserclass. Possibly can abstract as its own module?Things to consider
Not reading from cache when file is changed during live reload.
Related #88