/[Redis.pre-github]/lib/Redis.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Redis.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13 by dpavlin, Sat Mar 21 23:26:46 2009 UTC revision 14 by dpavlin, Sat Mar 21 23:36:26 2009 UTC
# Line 70  sub _sock_result_bulk { Line 70  sub _sock_result_bulk {
70          return $v;          return $v;
71  }  }
72    
73    sub _sock_ok {
74            my $ok = <$sock>;
75            confess dump($ok) unless $ok eq "+OK\r\n";
76    }
77    
78  =head1 Connection Handling  =head1 Connection Handling
79    
80  =head2 quit  =head2 quit
# Line 107  sub ping { Line 112  sub ping {
112  sub set {  sub set {
113          my ( $self, $k, $v, $new ) = @_;          my ( $self, $k, $v, $new ) = @_;
114          print $sock ( $new ? "SETNX" : "SET" ) . " $k " . length($v) . "\r\n$v\r\n";          print $sock ( $new ? "SETNX" : "SET" ) . " $k " . length($v) . "\r\n$v\r\n";
115          my $ok = <$sock>;          _sock_ok();
         confess dump($ok) unless $ok eq "+OK\r\n";  
116  }  }
117    
118  =head2 get  =head2 get
# Line 216  sub keys { Line 220  sub keys {
220  =cut  =cut
221    
222  sub randomkey {  sub randomkey {
223          my ( $self, $glob ) = @_;          my ( $self ) = @_;
224          print $sock "RANDOMKEY\r\n";          print $sock "RANDOMKEY\r\n";
225          _sock_result();          _sock_result();
226  }  }
227    
228    =head2 rename
229    
230      my $ok = $r->rename( 'old-key', 'new-key', $only_if_new );
231    
232    =cut
233    
234    sub rename {
235            my ( $self, $old, $new, $nx ) = @_;
236            print $sock "RENAME" . ( $nx ? 'NX' : '' ) . " $old $new\r\n";
237            _sock_ok();
238    }
239    
240  =head1 AUTHOR  =head1 AUTHOR
241    
242  Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>  Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>

Legend:
Removed from v.13  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26