|
11 | 11 | use Tarantool\Client\Client;
|
12 | 12 | use Tarantool\Client\Exception\RequestFailed;
|
13 | 13 | use Tarantool\Client\Schema\Criteria;
|
| 14 | +use Tarantool\Client\Schema\Operations; |
14 | 15 | use Tarantool\SymfonyLock\Cleaner;
|
15 | 16 | use Tarantool\SymfonyLock\SchemaManager;
|
16 | 17 | use Tarantool\SymfonyLock\TarantoolStore;
|
@@ -275,4 +276,29 @@ public function testDefaultSchemaCreationIsDisabled()
|
275 | 276 | $store = new TarantoolStore($client);
|
276 | 277 | $store->save(new Key(uniqid(__METHOD__, true)));
|
277 | 278 | }
|
| 279 | + |
| 280 | + public function testExpiredKeyOverwrite() |
| 281 | + { |
| 282 | + $resource = uniqid(__METHOD__, true); |
| 283 | + $key1 = new Key($resource); |
| 284 | + $key2 = new Key($resource); |
| 285 | + |
| 286 | + $store = $this->getStore(); |
| 287 | + |
| 288 | + $store->save($key1); |
| 289 | + $this->assertTrue($store->exists($key1)); |
| 290 | + $this->assertFalse($store->exists($key2)); |
| 291 | + |
| 292 | + $rows = $this->client->getSpace('lock')->select(Criteria::key([])); |
| 293 | + $this->assertCount(1, $rows); |
| 294 | + $this->client->getSpace('lock')->update([$rows[0][0]], Operations::set(2, microtime(true))); |
| 295 | + |
| 296 | + $this->assertFalse($store->exists($key1)); |
| 297 | + $this->assertFalse($store->exists($key2)); |
| 298 | + |
| 299 | + $store->save($key2); |
| 300 | + |
| 301 | + $this->assertFalse($store->exists($key1)); |
| 302 | + $this->assertTrue($store->exists($key2)); |
| 303 | + } |
278 | 304 | }
|
0 commit comments