/[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 11 by dpavlin, Sat Mar 21 23:09:48 2009 UTC
# Line 51  sub new { Line 51  sub new {
51          $self;          $self;
52  }  }
53    
54    sub _sock_result {
55            my $result = <$sock>;
56            warn "# result: ",dump( $result );
57            $result =~ s{\r\n$}{} || warn "can't find cr/lf";
58            return $result;
59    }
60    
61  =head1 Connection Handling  =head1 Connection Handling
62    
63  =head2 quit  =head2 quit
# Line 119  sub get { Line 126  sub get {
126    
127  =cut  =cut
128    
129            
130    
131  sub incr {  sub incr {
132          my ( $self, $key, $value ) = @_;          my ( $self, $key, $value ) = @_;
133          if ( defined $value ) {          if ( defined $value ) {
# Line 126  sub incr { Line 135  sub incr {
135          } else {          } else {
136                  print $sock "INCR $key\r\n";                  print $sock "INCR $key\r\n";
137          }          }
138          my $count = <$sock>;          _sock_result();
         warn "# $key = $count";  
         return $count;  
139  }  }
140    
141  =head2 decr  =head2 decr
# Line 145  sub decr { Line 152  sub decr {
152          } else {          } else {
153                  print $sock "DECR $key\r\n";                  print $sock "DECR $key\r\n";
154          }          }
155          my $count = <$sock>;          _sock_result();
         warn "# $key = $count";  
         return $count;  
156  }  }
157    
158  =head2 exists  =head2 exists
# Line 159  sub decr { Line 164  sub decr {
164  sub exists {  sub exists {
165          my ( $self, $key ) = @_;          my ( $self, $key ) = @_;
166          print $sock "EXISTS $key\r\n";          print $sock "EXISTS $key\r\n";
167          my $found = <$sock>;          _sock_result();
168          $found =~ s{\r\n$}{};  }
169          warn "# exists $key = $found";  
170          return $found;  =head2 del
171    
172      $r->del( 'key' ) || warn "key doesn't exist";
173    
174    =cut
175    
176    sub del {
177            my ( $self, $key ) = @_;
178            print $sock "DEL $key\r\n";
179            _sock_result();
180    }
181    
182    =head2 type
183    
184      $r->type( 'key' ); # = string
185    
186    =cut
187    
188    sub type {
189            my ( $self, $key ) = @_;
190            print $sock "type $key\r\n";
191            _sock_result();
192  }  }
193    
194  =head1 AUTHOR  =head1 AUTHOR

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

  ViewVC Help
Powered by ViewVC 1.1.26