Redis Not Deleting Session Keys
<p>I am using Redis to store my session data for my ExpressJS application and in the past have run into some issues where the persistent cookie is keeping my user logged in causing issues with development. I have tried to clear my session data with the redis-cli, but despite running <code>DEL KEYS *</code> and being given the <code>(integer) 0</code> response, I still see the sessions appear when I run <code>KEYS *</code>. Can anyone help me with removing that data?</p>

<p>Example:</p>

<pre><code>127.0.0.1:6379&gt; KEYS *
1) "sess:O7pchKqe-n7NUhP3lBANaf7LMjJG0U0a"
2) "sess:tSyQCCISPBpH88zT3MJjHw2tidttMdRs"
127.0.0.1:6379&gt; DEL KEYS *
(integer) 0
127.0.0.1:6379&gt; KEYS *
1) "sess:O7pchKqe-n7NUhP3lBANaf7LMjJG0U0a"
2) "sess:tSyQCCISPBpH88zT3MJjHw2tidttMdRs"
</code></pre>

<p>ExpressJS code storing the session data:</p>

<pre><code>var express = require('express');
var app = express();
var passport = require('passport');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
var path = require('path');

//Port Setting
var port = process.env.PORT || 3000;

//Set Morgan as Logger
app.use(morgan('dev'));

//Extract POST Data
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

//Session Cookie
app.use(cookieParser());
app.use(session({
    store: new RedisStore({
        host: '127.0.0.1',
        port: 6379
    }), 
    secret: 'super-secret',
    resave: true,
    saveUninitialized: true,
    cookie: {
        httpOnly: true,
        secure: false //turn to true on production once https is in place
    }
}));
</code></pre>