hapijs / catbox

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

Default Catbox starts Disconnected #174

Closed danielkwinsor closed 7 years ago

danielkwinsor commented 8 years ago

Originally posted here, I'm posting here as a bug.

Hapi 14.2.0 Catbox 7.1.2 Catbox-memory 2.0.3 0 other dependencies, fresh install.

Followed reference API 14.2.0 but simply added a console.log in the callback =>

const server = new Hapi.Server();
server.connection({ port: 80 });

const cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 });
cache.set('norway', { capital: 'oslo' }, null, (err) => {
TODO console here

    cache.get('norway', (err, value, cached, log) => {
TODO console here
        // value === { capital: 'oslo' };
    });
});

Neither this simple example nor my main application are able to set to the memory cache policy.

~/tempp$ node main.js 
{ Error: Disconnected
    at internals.Client.get (/Users/dwinsor/tempp/node_modules/catbox/lib/client.js:61:30)
    at internals.Policy._get (/Users/dwinsor/tempp/node_modules/catbox/lib/policy.js:205:17)
    at internals.Policy.get (/Users/dwinsor/tempp/node_modules/catbox/lib/policy.js:68:10)
    at cache.set (/Users/dwinsor/tempp/main.js:19:11)
    at _cache.set (/Users/dwinsor/tempp/node_modules/catbox/lib/policy.js:244:16)
    at internals.Client.set (/Users/dwinsor/tempp/node_modules/catbox/lib/client.js:113:16)
    at internals.Policy.set (/Users/dwinsor/tempp/node_modules/catbox/lib/policy.js:238:17)
    at Object.<anonymous> (/Users/dwinsor/tempp/main.js:17:7)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
  data: undefined,
  isBoom: true,
  isServer: true,
  output: 
   { statusCode: 500,
     payload: 
      { statusCode: 500,
        error: 'Internal Server Error',
        message: 'An internal server error occurred' },
     headers: {} },
  reformat: [Function] } null undefined
hueniverse commented 7 years ago

This is by design to make sure all implementation are the same, even when no connection is actually needed like in the memory cache.

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.