majgis/ngify

Caching strategy for fs calls

Closed this issue · 2 comments

A caching strategy is needed for file system calls.

Both fs.exists and fs.read are used and the results are not cached, which is redundant for all files inside a package.

The plan is to create a class specific to caching which will return promises based on the folder. There will also be a method to flush the cache in case it is needed in a long running process, but it doesn't seem possible to flush the cache without using a browserify plugin, which will be investigated.

A plugin is required to clear the cache.

I can think of two strategies

  1. Conservative
    a. Cache is disabled when the transform is used alone
    b. Using the plugin will enable the cache and flush it with each bundle execution

  2. Aggressive
    a. Cache is enabled when the transform is used alone, and the user is responsible for either calling ngify.clearCache() or switching to the plugin when caching becomes an issue on long running sessions.
    b. Using the plugin will flush the cache with each bundle execution.

    @baens and @nobleach, what are your thoughts?

This issue is no longer relevant since fs calls will be eliminated