Skip to content

Instantly share code, notes, and snippets.

@babo
Created November 22, 2015 12:21
Show Gist options
  • Save babo/05695b6d7175d78a1fe6 to your computer and use it in GitHub Desktop.
Save babo/05695b6d7175d78a1fe6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Redis;
use CGI;
my $cgi = new CGI;
my $vars = $cgi->Vars;
my ($type,$nr) = ($vars->{type},$vars->{id});
if ($nr > 0 && $type) {
$redis_srv = $ENV{'REDIS_SERVER'} || 'perftest.tnebn2.0001.use1.cache.amazonaws.com:6379';
$r = Redis->new(server => $redis_srv);
$key = "counters/$type/$nr";
$val = $r->incr($key);
print "Content-type: text/html\nCache-Control: max-age=0; must-revalidate\n\ntype=$type, nr = $nr, val = $val";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment