We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
transferred from hyper63/hyper-cloud#485
The text was updated successfully, but these errors were encountered:
Tom made some progress on a utility cache counter increment method
import { connect } from 'hyper-connect' const hyper = connect(process.env.HYPER) const increment = result => result.count ? result.count + 1 : 1 const update = name => count => hyper.cache.set(name, { count }) const resolve = x => result => result.ok ? x : Promise.reject({ status: 500, error: 'Could not find cache' }) const decrement = result => result.count ? result.count - 1 : 0 export function incrementCounter(type) { return function (x) { return hyper.cache.get(`${type}-counter`) .then(increment) .then(update(`${type}-counter`)) .then(resolve(x)) } } export function decrementCounter(type) { return function (x) { return hyper.cache.get(`${type}-counter`) .then(decrement) .then(update(`${type}-counter`)) .then(resolve(x)) } }
Sorry, something went wrong.
twilson63
No branches or pull requests
transferred from hyper63/hyper-cloud#485
The text was updated successfully, but these errors were encountered: