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

Policy.getOrGenerate returns content in two different formats #56

Closed
kpdecker opened this issue Feb 28, 2014 · 4 comments
Closed

Policy.getOrGenerate returns content in two different formats #56

kpdecker opened this issue Feb 28, 2014 · 4 comments
Assignees
Milestone

Comments

@kpdecker
Copy link
Contributor

@kpdecker kpdecker commented Feb 28, 2014

When using toCache, the return for Policy.getOrGenerate will be either the object containing the toCache method for the case of freshly initialized data or the return of toCache for cached data.

This was a bit confusing as I expected the data sent to the callback to be the same in either situation.

@hueniverse hueniverse added the bug label Mar 6, 2014
@hueniverse hueniverse added this to the 2.0.0 milestone Mar 6, 2014
@hueniverse hueniverse self-assigned this Mar 6, 2014
@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Mar 8, 2014

Dropping toCache() and getTtl() as they are no longer used. The generateFunc signature is changing to function(err, value, ttl) where ttl is null or undefined for default policy and 0 means not to cache.

@hueniverse hueniverse closed this in 3214f68 Mar 8, 2014
@kpdecker

This comment has been minimized.

Copy link
Contributor Author

@kpdecker kpdecker commented Mar 8, 2014

Will there be a way to feature detect the change in API? Fruit loops for
example is dependent on whatever version of catbox that is passed into it,
which is mostly likely dependent on the current hapi environment.

On Sat, Mar 8, 2014 at 5:31 PM, Eran Hammer notifications@github.comwrote:

Closed #56 #56 via 3214f683214f68
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/56
.

@kpdecker

This comment has been minimized.

Copy link
Contributor Author

@kpdecker kpdecker commented Mar 11, 2014

This is now causing our entire app to hang due to data not being saved properly and having no method of knowing which API we are dealing with. This is no migration strategy here?

@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Mar 11, 2014

You need to manage the versions externally to catbox. If you know you are passing version 1 catbox to a module expecting version 2, you can wrap the getOrGenerate method to simulate the old API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.