Skip to content

Commit 11dcacd

Browse files
committed
Change auth config to per server
1 parent e3ffe29 commit 11dcacd

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Extended/Cache/Backend/Redis.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*
77
* New BSD License
88
*
9-
* Redistribution and use in source and binary forms, with or without
9+
* Redistribution and use in source and binary forms, with or without
1010
* modification, are permitted provided that the following conditions are met:
11-
*
11+
*
1212
* * Redistributions of source code must retain the above copyright notice,
1313
* this list of conditions and the following disclaimer.
1414
*
@@ -21,15 +21,15 @@
2121
* software without specific prior written permission.
2222
*
2323
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3333
* POSSIBILITY OF SUCH DAMAGE.
3434
**/
3535

@@ -117,15 +117,15 @@ public function __construct(array $options = array())
117117
$result = $this->_redis->connect($server['host'], $server['port']);
118118
}
119119

120+
if ($this->_redis && $server['auth']) {
121+
$this->_redis->auth($server['password']);
122+
}
123+
120124
if ($result)
121125
$this->_redis->select($server['dbindex']);
122126
else
123127
$this->_redis = null;
124128
}
125-
126-
if ($this->_redis && $this->_options['auth']) {
127-
$this->_redis->auth($this->_options['password']);
128-
}
129129
}
130130

131131
/**

README.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ $redisCache = Zend_Cache::factory(
1818
'port' => 6379,
1919
'dbindex' => 1,
2020
// 'persistent' => false, // not a persistent connection
21+
// 'auth' => true, // enable authentication
22+
// 'password' => 'mypwd000000', // password to authenticate on redis server
2123
),
2224
),
2325
// 'key_prefix' => 'my_app', // if desire to add a prefix to all cache keys
24-
// 'auth' => true, // enable authentication
25-
// 'password' => 'mypwd000000', // password to authenticate on redis server
2626
))
2727
);
2828
</pre>

0 commit comments

Comments
 (0)