Tag: redis

使用connect-redis重复前缀

我正在尝试在我的web应用程序中使用connect-redis:“〜3.0.1”与express-session:“〜1.12.1”来存储用户会话。 但是当我在RedisStore中给前缀字段时,它重复了两次。 请告诉我是否做错了什么。 “mySession:mySession:yzO1mRhloENUMYLkAz2nZprcfvcFMNHY”“mySession:mySession:0L8prCJAoq0CmJ9tTwTJ_smQ4fH2R_H9” 在search时,我遇到了与laravel代码类似的问题: https://github.com/laravel/framework/issues/5353 请告诉我们是否有类似的情况发生,如果是的话,解决方法是什么。 以下是我正在使用的代码: var sessionMiddleware = session({ secret : 'secretPass', store: new RedisStore({ prefix:'mySession:', ttl: 1800}), resave: false, saveUninitialized: false }); app.use(function (req, res, next) { var tries = 3; function lookupSession(error) { if (error) { return next(error); } tries -= 1 if (req.session !== undefined) { return next(); } […]

是否可以将自定义命令添加到NodeJS的Redis客户端?

我正在使用redis Node软件包来连接,存储和检索来自Redis的数据。 当Redis引入这些命令时,是否可以向客户端添加新命令? 例如,有没有办法在客户端上定义GEOADD命令?

Ping命令在ioredis-Node JS中

有什么办法可以在我设置或获得密钥之前检查天气redis是否可用或终止? 我怎样才能做到这一点? 我正在使用ioredis模块。

Hapi.js Catbox Redis返回“server.cache不是一个函数”

所以我99%肯定我只是搞砸了一些愚蠢的东西。 我试图设置catboxcaching对象到redis。 我已经redis和运行,我可以用RDM(SQL专业版像redis)打它,但Hapi不合作。 我这样注册redis catboxcaching: const server = new Hapi.Server({ cache: [ { name: 'redisCache', engine: require('catbox-redis'), host: 'redis', partition: 'cache', password: 'devpassword' } ] }); 我这样做在server.js这段代码之后,我继续注册一些更多的插件,并启动服务器。 我也在文件的末尾导出服务器 module.exports = server; 然后在我的路线文件中,我试图设置一个testing路线,如下所示: { method: 'GET', path: '/cacheSet/{key}/{value}', config: { auth: false }, handler: function(req, res) { const testCache = server.cache({ cache: 'redisCache', expireIn: 1000 }); […]

快速会议无法设置未定义的属性“ID”

var redis = require('redis'); var router = express.Router(); var mysql = require('mysql'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var client = redis.createClient(); var session = require('express-session'), RedisStore = require('connect-redis')(session); var app = express(); app.use(cookieParser); app.use(session({ store : new RedisStore({ host:'localhost', port:7351, maxAge: 300000, client:client, ttl:260 } ), secret:'dafdsa', resave:false, saveUninitialized:true, })); 这是我的设置,这是我的代码 router.post('/', […]

在打字稿中,不能使promisifyAll Redis api与Bluebird

我无法使打字稿中的redis api promisifyAll。 import * as redis from 'redis'; import {RedisClient} from 'redis'; import * as Promise from 'bluebird'; Promise.promisifyAll(redis); const client: RedisClient = redis.createClient(CacheConfig); 我收到以下打字错误。

Redis NOAUTH错误 – 尽pipe在我的redis.conf文件中禁用了身份validation

在本地运行我的应用程序对本地Redis实例时,我看到以下错误。 ReplyError: Ready check failed: NOAUTH Authentication required. at JavascriptReplyParser.Parser.returnError (/Users/Olegzandr/WebstormProjects/node_redis/index.js:193:31) at JavascriptReplyParser.run (/Users/Olegzandr/WebstormProjects/node_redis/node_modules/redis-parser/lib/javascript.js:135:18) at JavascriptReplyParser.execute (/Users/Olegzandr/WebstormProjects/node_redis/node_modules/redis-parser/lib/javascript.js:112:10) at Socket.<anonymous> (/Users/Olegzandr/WebstormProjects/node_redis/index.js:269:27) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at readableAddChunk (_stream_readable.js:146:16) 我相信我已经通过在configuration文件中使用这些行禁用身份validation: # By default protected mode is enabled. You should disable it only if # you are sure you want clients from other hosts to connect […]

使用Redis存储的快速会话无法创build会话

我将Redis Express 4.13.1用作会话存储。 app.use(session({ store: new RedisStore, secret: '…', resave: false, saveUninitialized: true })); 它起初工作,但它不起作用(升级后的node.js)。 使用默认存储(内存)工作正常,但使用RedisStore,会话不会被创build。 这是创build会话的代码: router.post('/admin/login', (req, res, next) => { Auth.compare(…, () => { req.session.authorized = true; req.session.userId = id; console.log(req.session); // It prints well. Session is created res.redirect('/admin/main'); }); }); 那一刻,会议改变了: Session { cookie: { path: '/', _expires: null, originalMaxAge: null, […]

为我的节点应用程序select正确的数据库

我是新的节点js&我需要build议为我的节点应用程序select数据库。 比方说,我的名单上有几个游戏(以千计)。 数组应该看起来像这样: { "Football": { "John": [{ "age": "1", "weight": "2", "height": "3", }], "Smith": [{ "age": "11", "weight": "22", "height": "33", }], … }, "Golf": { "Ricky": [{ "age": "4", "weight": "5", "height": "6", }], "Jonathan": [{ "age": "44", "weight": "55", "height": "66", }], … }, … /* Thousand more to go */ […]

redis客户端和节点js – hgetall方法失败,结果为空

对于我来说,这是第一天使用redis cilent和node js。 我试图复制这个命令,我通过node.js中的redis-cli运行: 127.0.0.1:6379> HGETALL widgets:9145090003_00:00_00:00 1) "id" 2) "33305" 3) "loc" 4) "jamaica" 5) "days" 6) "" 这里是nodejs代码: client.hgetall("widgets:9145090003_00:00_00:00", function (err, replies) { console.log(err); replies.forEach(function (reply,i) { console.log(' ' + i + ':' + reply); }); }); 它返回null,然后尝试做foreach时失败。 我也试过: client.hgetall("widgets", function (err, replies) { console.log(err); replies.forEach(function (reply,i) { console.log(' ' + i + […]