mirror of
https://github.com/gamaio/lobli.git
synced 2024-12-22 19:52:40 +00:00
Change link expire time to future (in secs)
expire() and setex() store as a countdown from now and doesn't persist it between server reboots and repopulation. This is fixed by setting the keys to expire at a time in the future
This commit is contained in:
parent
169fe0fc23
commit
da266cce1a
@ -34,6 +34,7 @@
|
||||
}
|
||||
} while (1);
|
||||
|
||||
$now = time(NULL);
|
||||
$xTime = 3136320000; // About 100 years, give or take
|
||||
|
||||
// Delete the links in 24 hours, 1 week, 1 month respectevly
|
||||
@ -44,9 +45,10 @@
|
||||
$redis->rpush("links:$short", $link);
|
||||
$redis->rpush("links:$short", $title);
|
||||
$redis->rpush("links:$short", date("d/m/Y", strtotime($str)));
|
||||
$redis->expire("links:$short", $xTime);
|
||||
$redis->expireAt("links:$short", $now+$xTime);
|
||||
|
||||
$redis->setex("tracking:clicks:$link", $xTime, 1);
|
||||
$redis->set("tracking:clicks:$link", 1);
|
||||
$redis->expireAt("tracking:clicks:$link", $now+$xTime);
|
||||
|
||||
return "0$seperator$short$seperator$title";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user