简体   繁体   中英

How can I find a partial matched value in redis and update if it already exists?

Currently, I am using sadd to insert address:number. Is there a way I can check if the address exists on a partial value match and then update/replace it with the new value?

    //Update payout
    var payoutUpdate = [];
    payoutUpdate.push(['sadd', coin + ':userPayout', [addr.split('.')[0], userPayout].join(':')]);

    redisClient.multi(payoutUpdate).exec(function(err, results){
        if (err){
            logger.error(logSystem, logComponent, 'Issue with custom payout!' + JSON.stringify(error));
            return;
        }
    });

您可以使用SSCAN

SSCAN key cursor [MATCH pattern] [COUNT count]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM