Skip to content

Commit 0a3d663

Browse files
committed
Making cache tags more efficient by rewriting the API.
Related to php-cache/issues#21
1 parent 96ff7cf commit 0a3d663

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

MongoDBCachePool.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ protected function clearOneObjectFromCache($key)
7373
return true;
7474
}
7575

76-
protected function storeItemInCache($key, CacheItemInterface $item, $ttl)
76+
protected function storeItemInCache(CacheItemInterface $item, $ttl)
7777
{
7878
$object = [
79-
'_id' => $key,
79+
'_id' => $item->getKey(),
8080
'data' => serialize($item->get()),
8181
];
8282

8383
if ($ttl) {
8484
$object['expiresAt'] = time() + $ttl;
8585
}
8686

87-
$this->collection->updateOne(['_id' => $key], ['$set' => $object], ['upsert' => true]);
87+
$this->collection->updateOne(['_id' => $item->getKey()], ['$set' => $object], ['upsert' => true]);
8888

8989
return true;
9090
}

Tests/IntegrationTagTest.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"require-dev": {
3434
"phpunit/phpunit": "^4.0|^5.1",
35-
"cache/integration-tests": "0.7.0"
35+
"cache/integration-tests": "0.9.0"
3636
},
3737
"provide": {
3838
"psr/cache-implementation": "^1.0"

0 commit comments

Comments
 (0)