Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var container = require('rhea');
var cache = [0, 1];
function fib(n) {
if (n >= cache.length) {
for(var i = 2; i <= n; i++) {
cache[i] = cache[i-2] + cache[i-1];
}
}
return cache[n];
}
var server = container.rpc_server('amqp://localhost:5672/examples');
server.bind_sync(fib);
var map = {};
function put(args, callback) {
map[args.key] = args.value;
callback();
}
function get(key, callback) {
callback(map[key]);
}
server.bind(put);
server.bind(get);