hapijs / catbox

Multi-strategy object caching service
Other
494 stars 72 forks source link

Policy.getOrGenerate returns content in two different formats #56

Closed kpdecker closed 10 years ago

kpdecker commented 10 years ago

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 commented 10 years ago

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.

kpdecker commented 10 years ago

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 https://github.com/spumko/catbox/issues/56 via 3214f68https://github.com/spumko/catbox/commit/3214f68ce3a910cafae754d808711a4d98cae6df .

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

kpdecker commented 10 years ago

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 commented 10 years ago

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.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.