| 143 | | is_deeply([1, 'ex'], $rv->{xx}, "X is correct"); |
| 144 | | is_deeply([2, 'why'], $rv->{wye}, "Y is correct"); |
| | 143 | # CAS is returned with all gets. |
| | 144 | $rv->{xx}->[2] = 0; |
| | 145 | $rv->{wye}->[2] = 0; |
| | 146 | is_deeply($rv->{xx}, [1, 'ex', 0], "X is correct"); |
| | 147 | is_deeply($rv->{wye}, [2, 'why', 0], "Y is correct"); |
| 160 | | |
| 161 | | <<EOT; |
| 162 | | def testIncrDoesntExistNoCreate(self): |
| 163 | | """Testing incr when a value doesn't exist (and not creating).""" |
| 164 | | try: |
| 165 | | self.mc.incr("x", exp=-1) |
| 166 | | self.fail("Expected failure to increment non-existent key") |
| 167 | | except MemcachedError, e: |
| 168 | | self.assertEquals(memcacheConstants.ERR_NOT_FOUND, e.status) |
| 169 | | self.assertNotExists("x") |
| 170 | | |
| 171 | | def testIncrDoesntExistCreate(self): |
| 172 | | """Testing incr when a value doesn't exist (and we make a new one)""" |
| 173 | | self.assertNotExists("x") |
| 174 | | self.assertEquals(19, self.mc.incr("x", init=19)) |
| 175 | | |
| 176 | | def testDecrDoesntExistNoCreate(self): |
| 177 | | """Testing decr when a value doesn't exist (and not creating).""" |
| 178 | | try: |
| 179 | | self.mc.decr("x", exp=-1) |
| 180 | | self.fail("Expected failiure to decrement non-existent key.") |
| 181 | | except MemcachedError, e: |
| 182 | | self.assertEquals(memcacheConstants.ERR_NOT_FOUND, e.status) |
| 183 | | self.assertNotExists("x") |
| 184 | | |
| 185 | | def testDecrDoesntExistCreate(self): |
| 186 | | """Testing decr when a value doesn't exist (and we make a new one)""" |
| 187 | | self.assertNotExists("x") |
| 188 | | self.assertEquals(19, self.mc.decr("x", init=19)) |
| 189 | | EOT |
| 435 | | sub old_gets { |
| 436 | | my $self = shift; |
| 437 | | my $key = shift; |
| 438 | | |
| 439 | | my $data = $self->_doCmd(::CMD_GET, $key, ''); |
| 440 | | my $header = substr $data, 0, 12, ''; |
| 441 | | my ($flags, $ident_hi, $ident_lo) = unpack "NNN", $header; |
| 442 | | my $ident = ($ident_hi * 2 ** 32) + $ident_lo; |
| 443 | | |
| 444 | | return $flags, $ident, $data; |
| 445 | | } |
| 446 | | |