Node-redis: client.set تنتهي صلاحيتها

تم إنشاؤها على ١٥ فبراير ٢٠١٩  ·  1تعليق  ·  مصدر: NodeRedis/node-redis

لقد كنت أستخدم ذاكرة التخزين المؤقت حتى الآن بهذه الطريقة

self.client.set(key, value, 'EX', _expire, function(err, res) {
                // res is null when the key is missing
                if(err) self.logger.error("RedisStore.set err %@", err);
                else self.logger.debug("RedisStore.set %@", key);
                return callback(err, res);
            }); 

تمرير EX ، وتعيين متغير معبرًا عنه بالثواني.
أرى من الاختبارات أنه يتم استخدامه بطريقة مختلفة

client.set(['ttl key', 'ttl val'], helper.isString('OK'));
                client.expire(['ttl key', '100'], helper.isNumber(1));
                client.TTL(['ttl key'], function (err, ttl) {
                    assert(ttl >= 99);
                    assert(ttl <= 100);
                    done(err);
                });

ما هي الطريقة الصحيحة في الإصدار الحالي؟

question

>كل التعليقات

كلاهما صحيح. هذا مستقل عن node_redis وكيف يعمل Redis نفسه. من فضلك لا تسأل أسئلة Redis عامة هنا.

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات