-
Notifications
You must be signed in to change notification settings - Fork 10
/
rediscache.php
43 lines (37 loc) · 889 Bytes
/
rediscache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
define("SET_TAGS",'zc:tags');
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->select(1); // select FPC
$tags=$redis->sMembers(SET_TAGS);
$tags_count=count($tags);
$empty_tags_count=0;
$slowttl=0;
foreach($tags as $tag)
{
$tag="zc:ti:".$tag;
$tag_members=$redis->sMembers($tag);
$members_count=0;
foreach($tag_members as $tag_member) {
if($redis->exists("zc:k:".$tag_member)) {
$members_count++;
//$ttl=$redis->ttl("zc:k:".$tag_member);
//if($ttl>43200) $slowttl++;
}
else {
// $ttl=$redis->ttl("zc:k:".$tag_member);
// echo $ttl."\n";
// echo "zc:k:".$tag_member."\n";
}
// sleep(0.01); // dont kill the server
}
if($members_count == 0) {
echo "+";
$empty_tags_count++;
}
else {
echo ".";
}
}
print "Tags count: $tags_count, empty tags count: $empty_tags_count, slowttl=$slowttl\n";
?>