Skip to content

Feature: option for disabling caching#56

Merged
antoinechalifour merged 2 commits intomasterfrom
disable-caching
Aug 31, 2019
Merged

Feature: option for disabling caching#56
antoinechalifour merged 2 commits intomasterfrom
disable-caching

Conversation

@antoinechalifour
Copy link
Copy Markdown
Owner

This pull requests adds a new option to the Memento configuation: disableCachingPatterns, which is an array of objects that have a method and pattern properties.

  • The method property is a case insensitive HTTP method.
  • The pattern property is a glob tested against the incoming URL (the minimatch package is used as an implementation).

Fixes #54 .

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 31, 2019

Codecov Report

Merging #56 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   99.04%   99.06%   +0.02%     
==========================================
  Files          21       21              
  Lines         417      427      +10     
  Branches       41       43       +2     
==========================================
+ Hits          413      423      +10     
  Misses          1        1              
  Partials        3        3
Impacted Files Coverage Δ
src/domain/entity/index.ts 100% <ø> (ø) ⬆️
src/domain/usecase/RespondToRequest.ts 100% <100%> (ø) ⬆️

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 f871218...fcc0034. Read the comment docs.

@francoischalifour
Copy link
Copy Markdown

Here's another suggestion for the option name: requestIgnorePatterns.

{
  "requestIgnorePatterns": [{
    "method": "GET",
    "urlPattern": "/pokemon/*/abilities"
  }]
}

From what I see, only the URL can match against the pattern. It would make sense to mention the term "url" in the "pattern" key name.

@antoinechalifour
Copy link
Copy Markdown
Owner Author

antoinechalifour commented Aug 31, 2019

I definitely like urlPattern more than pattern!
Not really about requestIgnorePatterns, I think that disableCachingPatterns is more explicit in the sense that this option... disables caching.

Request are not ignored, they are forwarded using Memento, they just aren't cached.

@antoinechalifour antoinechalifour merged commit 6c71144 into master Aug 31, 2019
@antoinechalifour antoinechalifour deleted the disable-caching branch August 31, 2019 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add mode to disable caching

3 participants