|
LinkID |
Resolved Link |
Total Clicks |
Date Added |
zRangeByScore("tracking:clicks", "-inf", "+inf");
$stats = array_reverse($stats);
$stats = array_slice($stats, 0, 5, true);
foreach($stats as $id){ // There should only be 5, but the page doesn't limit how many
$trTtl = $redis->ttl("links:$id");
if($trTtl == -2){ // The link has been deleted, no need to track it anymore
$redis->zRem("tracking:clicks", $id);
continue;
}
$linkData = $redis->lRange("links:$id", 0, -1);
$link = $linkData[0];
$title = $linkData[1];
$date = $linkData[2];
$trackClicks = $redis->zScore("tracking:clicks", $id);
echo "
|
$id |
$link |
$trackClicks |
$date |
";
}
?>