chriso / redback

A high-level Redis library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can we reuse variable this way

angelochen960 opened this issue · comments

Hi,
i got following code, setRedisKeys will be called by a timer every hour, is this ok?

var myhash

function setRedisKeys() {
myhash = redback.createHash(dateString)
}

Yes that's fine, although there's no reason why you can't create it outside the function

var myhash = redback.createHash(dateString);
function setRedisKeys() {
    //Use myhash here
}