1

I'm trying to create "Notifications" using Redis, currently with PHPRedis. I would like to store multiple notifications for each user (by USER_ID) with multiple "key => value" in it.

Notification may look like that (as PHP array):

$notification = array('type' => 'item', 'time' => '123456789', 'type_id' => 10, 'message' => 'some example message here...');

So, how can i just push such notifications to "user" and let expire single of such notifications after 1 day?

Will get at the end something like this... Just by USER_ID:

'user_id_1' => array(
  array('type' => 'item', 'time' => '123456789', 'type_id' => 10, 'message' => 'some example message here...'),
  array('type' => 'item', 'time' => '123456789', 'type_id' => 11, 'message' => 'some example message here...'),
  array('type' => 'item', 'time' => '123456789', 'type_id' => 12, 'message' => 'some example message here...'),
)

Thanks!

  • I think it's better to say, i would like to create multiple notifications, so, that i can select all notifications by user_id. Possible?! – Gordon Freeman Dec 07 '14 at 16:12

0 Answers0