index.js
function persist(pErr, pVal) {
          if (pErr) {
            return cb(pErr);
          }

          if (ttl) {
            conn.setex(key, ttl, pVal, handleResponse(conn, cb));
          } else {
            conn.set(key, pVal, handleResponse(conn, cb));
          }
        }
function persist(pErr, pVal) {
          if (pErr) {
            return cb(pErr);
          }

          if (ttl) {
            conn.setex(key, ttl, pVal, handleResponse(conn, cb));
          } else {
            conn.set(key, pVal, handleResponse(conn, cb));
          }
        }
function persist ( pErr , pVal ) { if ( pErr ) { return cb ( pErr ) ; } if ( ttl ) { conn . setex ( key , ttl , pVal , handleResponse ( conn , cb ) ) ; } else { conn . set ( key , pVal , handleResponse ( conn , cb ) ) ; } }
Refactored to remove duplicate code.
Refactored to remove duplicate code .