Wondering if it is even possible to return values from my redis cache while i am performing a PHP foreach loop?
I might be over thinking this...
essentially i have a MySql instance and a redis instance.
my MySql instance returns the following:
array:5 [▼
0 => array:6 [▼
"user_id" => 2
"short_url_key" => "aQpjoM"
"original_url" => "www.domain.com/"
"deleted_at" => null
"created_at" => "2017-03-11 08:19:02"
"updated_at" => "2017-03-11 08:19:02"
]
1 => array:6 [▼
"user_id" => 2
"short_url_key" => "olW7uN"
"original_url" => "www.domain.com/products/"
"deleted_at" => null
"created_at" => "2017-03-11 09:05:23"
"updated_at" => "2017-03-11 09:05:23"
]
2 => array:6 [▼
"user_id" => 2
"short_url_key" => "u4rjLA"
"original_url" => "www.domain.com/products/asdf"
"deleted_at" => null
"created_at" => "2017-03-11 09:05:56"
"updated_at" => "2017-03-11 09:05:56"
]
3 => array:6 [▼
"user_id" => 2
"short_url_key" => "fOuOju"
"original_url" => "www.domain.com/"
"deleted_at" => null
"created_at" => "2017-03-11 09:06:30"
"updated_at" => "2017-03-11 09:06:30"
]
4 => array:6 [▼
"user_id" => 2
"short_url_key" => "XmSBTK"
"original_url" => "www.domain.com/xyz"
"deleted_at" => null
"created_at" => "2017-03-11 09:18:54"
"updated_at" => "2017-03-11 09:18:54"
]
]
Now My Redis instance stores the short_url_key, the original_url & I store the visits their as well (which is what i am trying to return along with this data) The visits just incriments on my redis key but would love to return this data along as well... Trying to think of how i can do that as part of my PHP loop? Or is their something I am not thinking of?
ideally I would like to append each of these arrays with the visits count from my redis instance.
"visits" => 22
Cheers
Citti
via Citti