hapijs / catbox-memcached Goto Github PK
View Code? Open in Web Editor NEWMemcached adapter for catbox
License: Other
Memcached adapter for catbox
License: Other
I'm trying to use catbox-memcached
as caching provider in Hapi.
It works fine when the memcached
server is running when I start the Hapi
server, but when the memcached
server is down on startup, the whole application freezes before starting the Hapi
server.
Move over from catbox.
The memcached
driver that this library requires uses consistent hashing to distribute the keys among the available servers. That means that if any server is down, all the keys that were stored in it are redistributed to the servers that are still up. The problem is that if this happens when an application is starting the adapter connection fails because it cannot connect to the server that is down (the adapter does a connection test before returning the control to the application).
The test connection should be removed (or rethinked) so applications can benefit from the error management the driver provides.
I will submit a PR for this soon. Meanwhile I will be using a fork in my project to test that it works OK.
See details at: hapijs/yar#53
I have seen production issue with the memcached driver. The driver hangs if the memcached instance has a network partition. This is intermittent behavior. I was thinking of upgrading the underlying driver to this memjs, which redislabs has backed on their blog https://redislabs.com/node-js-memcached. Any thoughts on that kind of change?
memcached loose the current domain when doing requests to it. So we need to restore domains manually after each request to prevent strange errors from happening in hapi.
Clean up tests to be more in line with outmoded/discuss#24
This module is not being maintainer to the hapi.js standards.
Not sure if this is an implementation error, but after caching an item, neither the 'stored', or 'ttl' values are set - only the item.
https://github.com/hapijs/catbox
get(key, callback) - retrieve an item from the cache engine if found where:
key - a cache key object (see below).
callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object contains the following:
item - the value stored in the cache using set().
stored - the timestamp when the item was stored in the cache (in milliseconds).
ttl - the remaining time-to-live (not the original value used when storing the object).
I've called set with...
cache.set(sid, {account: account}, 86400000, function (err) {...})
Retrieving the cached object with...
cache.get(sid, function (err, cached) {...}
Returns the cached object below, with 'account' set, but I don't see properties for 'ttl', and 'stored'?
{account: account}
Am I missing something?
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
Mentioned by @jamesgibson14 in #26
If memcached server dies the request doesn't timeout.
@chapel we are doing a refresh to update our modules... are you still interested in maintaining this module? If so, can you update to the latest node version and ES6 hapi style guide? http://hapijs.com/styleguide
Hi,
I have just noticed that the Travis build is current failing for all versions of node.js:
https://travis-ci.org/hapijs/catbox-memcached
It looks like it is a problem with eslint, rather than the code:
Line undefined: undefined - Cannot find module 'eslint-config-hapi'
Referenced from: /home/travis/build/hapijs/catbox-memcached/.eslintrc.json
nick.
I'm trying to get an example working. I've looked at the example provided, but it hasn't helped.
Here's my code:
var Hapi = require('hapi')
, Catbox = require('catbox')
;
var options = {
cors:true,
router:{
isCaseSensitive:false,
},
cache: new Catbox.Client(require('catbox-memcached'),{
location: "localhost:11211"
})
};
var server = new Hapi.Server(8000, options);
server.start(function () {
console.log('Server started at: ' + server.info.uri);
});
Here's the exception:
[1] cache must be a Function
[2] engine is required
[3] cache must be an array←[0m
at Object.exports.assert (C:\Users\joshchan\github.com\CompassPHS\Survey-Site\node_modules\hapi\node_modules\hoek\lib\index.js:421:11)
at Object.exports.assert (C:\Users\joshchan\github.com\CompassPHS\Survey-Site\node_modules\hapi\lib\schema.js:15:10)
at new module.exports.internals.Server (C:\Users\joshchan\github.com\CompassPHS\Survey-Site\node_modules\hapi\lib\server.js:74:12)
at Object.<anonymous> (C:\Users\joshchan\github.com\CompassPHS\Survey-Site\src\server\server.js:15:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain [as _onTimeout] (module.js:497:10)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
What am I missing?
Remove the following features which are not compliant with HapiJS standards:
Hey,
I am a happy user of your library, but as my project grows we have a lot of dependencies.
We could save a lot of space if you added .npmignore
file to your project.
I even found tool that can help you with it: https://github.com/inikulin/dmn
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.