Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

feat: invalidate cache #9

Merged
merged 3 commits into from
Aug 28, 2017
Merged

feat: invalidate cache #9

merged 3 commits into from
Aug 28, 2017

Conversation

alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Jun 8, 2017

Steps:

  • Add ability to determinate own cache identifier.
  • Invalidate cache after cache-loader updated.
  • Invalidate cache after cache-loader options changed.
  • Invalidate cache if environment changed.
  • Invalidate cache if loader in chain updated.
    As sokra says:
"postinstall": "rm -rf .cache-loader"

We can just add this in README.

  • Search solution for loaders using fs based configuration files, maybe just add docs.
    As sokra says:
configuration files -> loaders should add these files to their dependencies (with `this.addDependency`). dependencies' mtimes are stored by the cache-loader

Partial fixed: #3

@codecov
Copy link

codecov bot commented Jun 8, 2017

Codecov Report

Merging #9 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@         Coverage Diff         @@
##           master   #9   +/-   ##
===================================
  Coverage       0%   0%           
===================================
  Files           2    2           
  Lines          80   85    +5     
  Branches       12   12           
===================================
- Misses         68   74    +6     
+ Partials       12   11    -1
Impacted Files Coverage Δ
src/index.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b0cffa...048da77. Read the comment docs.

const options = loaderUtils.getOptions(this) || {};
const cacheDirectory = options.cacheDirectory || path.resolve('.cache-loader');
const loaderOptions = loaderUtils.getOptions(this) || {};
const defaultOptions = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be the same for every call to pitch() so it would make sense to define it outside the fn.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@STRML done

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - doesn't appear pushed though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evilebottnawi Can't the whole defaultOptions block be moved for some reason ? 🙃

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky oh, yep, your are right

@michael-ciniawsky
Copy link
Member

What's missing here ? babel-loader #60 was merge a while ago 😛

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adressing @STRML comment maybe a good idea :)

@michael-ciniawsky michael-ciniawsky changed the title [WIP] feat: invalidate cache feat: invalidate cache Jun 27, 2017
@michael-ciniawsky
Copy link
Member

Removing the WIP seems to be good to go ?

src/index.js Outdated
const callback = this.async();
const hash = digest(remainingRequest);
const hash = digest(JSON.stringify({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to:

const hash = digest(remainingRequest + cacheIdentifier);

Faster. Options don't need to be included.

@sokra sokra closed this Aug 28, 2017
@sokra sokra reopened this Aug 28, 2017
@sokra sokra merged commit 663e18a into master Aug 28, 2017
@sokra sokra deleted the invalidate-cache branch August 28, 2017 14:25
@sokra
Copy link
Member

sokra commented Aug 28, 2017

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add cache invalidation
4 participants