I am trying to build a chat room and I want to store additional information like: nickname, time and avatar then associate them to a message.
I might use ':' to separate between some properties but it doesn't sound like an elegant way!
$list = "message_history";
$message = $data['nickname'] . ':' . $data['message'];
Redis::lpush($list, $message);
Is there an elegant way to do so using Redis ?
I ended up using a hash 'hset'. And by giving each message an id and save them in a separate list I could access all the messages through that list.