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

Add ttl, update docs and move to declarative API #2

Merged
merged 3 commits into from May 21, 2021
Merged

Conversation

renancaraujo
Copy link
Member

@renancaraujo renancaraujo commented May 21, 2021

Move to an API that allows composability:

Simple:

// this is unchanged, not a shorthand anymore, the default:
CachedValue(() => factorial(originalValue));

// from:
CachedValue.simple(() => factorial(originalValue));

// to:
CachedValue(() => factorial(originalValue));

Dependent:

// from:
final factorialCache = CachedValue.dependent(
  on: () => originalValue,
  compute: () => factorial(originalValue),
);

// to:
final factorialCache = CachedValue(
  () => factorial(originalValue),
).withDependency(() => originalValue);

@renancaraujo renancaraujo marked this pull request as ready for review May 21, 2021 20:41
@renancaraujo renancaraujo merged commit 18da912 into main May 21, 2021
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.

None yet

1 participant