How does nodejs redis set the expiration time?

how does nodejs redis set the expiration time?

Mar.10,2021

call the expired command of redis.
EXPIRE key seconds
this has nothing to do with what language is used.


const redis = require("redis");
const redisConfig = {
    host: "redisip",
    port: ""
};
const __createClient = () => {
    const client = redis.createClient(redisConfig.port, redisConfig.host);
    //redis
    client.on("error", function (err) {
        logger("redis error: " + err);
    });
    return client;
};

const client = __createClient();
client.expire("key", "", (err, isSuccess) => {
    client.quit();
    if (err || !isSuccess) {
        //your code
    } else {
        //your another code
    }
});

const redis = require('redis')
import { redisConfig } from '../config/index';
const redisClient = redis.createClient(redisConfig);
redisClient.select(2, (res) => {
    console.log(res)
})
export function setItem(key, value, exprires) {
    redisClient.set(key, value);
    //
    if (exprires) {
        redisClient.expire(key, exprires);
    }
}

can refer to

used in my project.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea2163-1ba2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea2163-1ba2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?