title: Hapi.js Catbox Redis returning "server.cache is not a function"
body: <p>So I'm like 99% sure I'm just screwing up something dumb here.</p>
  
  <p>I'm trying to set up catbox to cache objects to redis. I have redis up and running and I can hit it with RDM (sql pro like utility for redis) but Hapi is not cooperating.</p>
  
  <p>I register the redis catbox cache like so:</p>
  
  <pre><code>const server = new Hapi.Server({
  cache: [
  {
    name: 'redisCache',
    engine: require('catbox-redis'),
    host: 'redis',
    partition: 'cache',
    password: 'devpassword'
  }
  ]
  });
  </code></pre>
  
  <p>I am doing this in server.js After this block of code I go on to register some more plugins and start the server. I also export the server at the end of the file</p>
  
  <pre><code>module.exports = server;
  </code></pre>
  
  <p>Then in my routes file, I am attempting to set up a testing route like so:</p>
  
  <pre><code>{
      method: 'GET',
      path: '/cacheSet/{key}/{value}',
      config: { auth: false },
      handler: function(req, res) {
          const testCache = server.cache({
              cache: 'redisCache',
              expireIn: 1000
          });
  
          testCache.set(req.params.key, req.params.value, 1000, function(e) {
              console.log(e);
              res(Boom.create(e.http_code, e.message));
           })
          res(req.params.key + " " + req.params.value);
      }
  },
  </code></pre>
  
  <p><strong>Note:</strong> My routes are in an external file, and are imported into server.js where I register them.</p>
  
  <p>If I comment out all the cache stuff on this route, the route runs fine and returns my params.</p>
  
  <p>If I run this with the cache stuff, at first I got "server not defined". So I then added </p>
  
  <pre><code>const server                        = require('./../server.js');
  </code></pre>
  
  <p>to import the server.</p>
  
  <p>Now when I run this, I get "server.cache is not a function" and a 500 error.</p>
  
  <p>I don't understand what I'm doing wrong. My guess is that I'm importing server, but perhaps it's the object without all the configs set so it's unable to use the .cache method. However this seems wrong because .cache should always be a default method with the default memory cache, so even if my cache registration isn't active yet, server.cache should theoretically still be a method.</p>
  
  <p>I know it has to be something basic I'm messing up, but what?</p>