store last table.name.username json for 15 min
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 11 Jul 2011 16:29:18 +0000 (18:29 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 11 Jul 2011 16:29:18 +0000 (18:29 +0200)
lib/APKPM/Store.pm

index fed95f3..def1d83 100644 (file)
@@ -48,6 +48,12 @@ sub pg_insert {
        my $h_lc;
        $h_lc->{ lc $_ } = $h->{$_} foreach keys %$h;
 
        my $h_lc;
        $h_lc->{ lc $_ } = $h->{$_} foreach keys %$h;
 
+       if ( my $username = $h->{username} ) {
+               my $key = join('.', 'table', $table, $username);
+               $redis->set( $key => $self->e_json($h) );
+               $redis->expire( $key => 15 * 60 ); # 15 min timeout
+       }
+
        $sth->execute( map { $h_lc->{$_} } @c );
 }
 
        $sth->execute( map { $h_lc->{$_} } @c );
 }