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 getTtl function to WrapConfig options #1

Open
jpwilliams opened this issue Jan 4, 2020 · 1 comment
Open

Add getTtl function to WrapConfig options #1

jpwilliams opened this issue Jan 4, 2020 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@jpwilliams
Copy link
Owner

This function could receive the data ouput from the work function given and return a ttl number for the psetex in _pushData.

This would cover many cases, but still not the HTTP example in the event where the resulting data is the document itself but the TTL comes from the headers.

@jpwilliams jpwilliams added bug Something isn't working enhancement New feature or request labels Jan 4, 2020
@jpwilliams jpwilliams self-assigned this Jan 4, 2020
@jpwilliams
Copy link
Owner Author

Whatever route, WrapConfig should definitely include a ttl option so we can override the global value per call.

To solve the issue in the HTTP example, though, we could add a boolean WrapConfig option which denotes that the return value of the passed function is a new interface which returns a ttl and data.

interface WrapResult {
	data: any;
	ttl?: number;
}

This feels shit, though, as it requires people to repurpose functions.

Maybe adding both this and a getTtl function in WrapConfig would be good? That way the user could choose the less invasive option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant