Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace shouldCache hook with transform hook #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mlolson
Copy link
Contributor

@mlolson mlolson commented Oct 9, 2018

  • transform hook applies a function to values returned from upstream.
  • If transform returns undefined, the value is not cached.

@@ -43,7 +43,7 @@ export default function wrap(opts, func){
ttr = ttl * DEFAULT_TTR_RATIO,
layers = [],
before = _ => Q(_), // Munge arguments.
shouldCache = () => true, // Should we cache the response from func?
transform = _ => _, // Transform response from func. undefined won't be cached.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a name that would be more descriptive of where this lives in the lifecycle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... preCache?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

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.

2 participants