/[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 9 by dpavlin, Sat Mar 21 22:54:10 2009 UTC revision 10 by dpavlin, Sat Mar 21 23:05:02 2009 UTC
# Line 119  sub get { Line 119  sub get {
119    
120  =cut  =cut
121    
122    sub sock_result {
123            my $result = <$sock>;
124            warn "# result: ",dump( $result );
125            $result =~ s{\r\n$}{} || warn "can't find cr/lf";
126            return $result;
127    }
128            
129    
130  sub incr {  sub incr {
131          my ( $self, $key, $value ) = @_;          my ( $self, $key, $value ) = @_;
132          if ( defined $value ) {          if ( defined $value ) {
# Line 126  sub incr { Line 134  sub incr {
134          } else {          } else {
135                  print $sock "INCR $key\r\n";                  print $sock "INCR $key\r\n";
136          }          }
137          my $count = <$sock>;          sock_result();
         warn "# $key = $count";  
         return $count;  
138  }  }
139    
140  =head2 decr  =head2 decr
# Line 145  sub decr { Line 151  sub decr {
151          } else {          } else {
152                  print $sock "DECR $key\r\n";                  print $sock "DECR $key\r\n";
153          }          }
154          my $count = <$sock>;          sock_result();
         warn "# $key = $count";  
         return $count;  
155  }  }
156    
157  =head2 exists  =head2 exists
# Line 159  sub decr { Line 163  sub decr {
163  sub exists {  sub exists {
164          my ( $self, $key ) = @_;          my ( $self, $key ) = @_;
165          print $sock "EXISTS $key\r\n";          print $sock "EXISTS $key\r\n";
166          my $found = <$sock>;          sock_result();
167          $found =~ s{\r\n$}{};  }
168          warn "# exists $key = $found";  
169          return $found;  =head2 del
170    
171      $r->del( 'key' ) || warn "key doesn't exist";
172    
173    =cut
174    
175    sub del {
176            my ( $self, $key ) = @_;
177            print $sock "DEL $key\r\n";
178            sock_result();
179  }  }
180    
181  =head1 AUTHOR  =head1 AUTHOR

Legend:
Removed from v.9  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26