Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Component - TagAwareAdapter failing to retrieve keys using RedisAdapter backed by Predis using a redis cluster #21858

Closed
chasen opened this issue Mar 3, 2017 · 1 comment

Comments

@chasen
Copy link

chasen commented Mar 3, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.4

Other possible relevant info

Type Version
Predis version 1.1.1
Redis version 3.2.8
OS Debian GNU/Linux 8.7 (jessie)

I have a redis cluster setup with 3 servers, If i just use the RedisAdapter passing in the Predis client getting and setting keys works as expected, However if i wrap the RedisAdapter in the TagAwareAdapter I am no longer able to retrieve the keys.

$client = new \Predis\Client([
   'redis://server1.com',
   'redis://server2.com',
   'redis://server3.com',
],[
    'cluster' => 'redis'
]);
$cache = new RedisAdapter(
    $client,
    'my_prefix',
    60 // 60 second default ttl
);
$tagCache = new TagAwareAdapter($cache);

// Test RedisAdapter
$testItem = $cache->getItem('test_item');
$testItem->set('test_value');
$testSave = $cache->save($testItem);
var_dump($testSaved); //true

$retrieveItem = $cache->getItem('test_item');
var_dump($retrieveItem->isHit()); //true
var_dump($retrieveItem->get()); //test_value 

//Test TagAware

$tagItem = $tagCache->getItem('test_tag_item');
$tagItem->set('test_tag_value');
$tagItem->tag('tagged_test')
$tagTestSaved = $tagCache->save($tagItem);
var_dump($tagTestSaved); //true

$retrieveTagItem = $tagCache->getItem('test_tag_item');
var_dump($retrieveTagItem ->isHit()); //false
var_dump($retrieveTagItem ->get()); //null 
@nicolas-grekas
Copy link
Member

Fixed in #21908

nicolas-grekas added a commit that referenced this issue Mar 7, 2017
This PR was merged into the 3.2 branch.

Discussion
----------

[Cache] Fix Redis pipelining/multi-ops

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21858
| License       | MIT
| Doc PR        | -

`MSET` doesn't work on clustered connections. Let's use pipelining instead.

Commits
-------

f1648e2 [Cache] Fix Redis pipelining/multi-ops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants