-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[WIP] Redis cache storage #3709
[WIP] Redis cache storage #3709
Conversation
* @param \Zend\Cache\Storage\Adapter\RedisOptions $options | ||
* @see \Zend\Cache\Storage\Adapter\Abstract | ||
*/ | ||
public function __construct(RedisOptions $options = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the first method.
$options
can be array|Traversable|AbstractOptions
-> remove the type-hint
@piteer1 First, thanks for this PR - it is linked to #2582 but there are some points to solve:
PS: I'm not available until next Tuesday |
Hello, Thank you for fast review. I did a mistake that I was basing on older version of memcached storage. I will try to make all the corrections during this weekend. I will make also RedisResourceManager to make it consistent with memcached storage. Best regards |
Hello, Generally I've updated the code to use a resource manager. I'm not too happy of the implementation yet. Best regards |
/** | ||
* Set options. | ||
* | ||
* @param array|Traversable|MemcachedOptions $options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemcachedOptions
-> RedisOptions
@piteer1 Currently I can't test because of personal relocation. |
@marc-mabe Still I think some changes are necessary. I'm not sure about some things #3709 (comment) I will make later corrections according to your comments. |
/** | ||
* Flushes all contents of current database | ||
* | ||
* @return bool Always true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't null be a better return value if the return value is always the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Freeaqingme That is described by FlushableInterface
. It's because an operation could run into a failure throwing an exception but with the exception-handler plugin you could ignore such exception and return FALSE
instead.
@piteer1 The phpdoc description isn't good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated a little bit this phpdoc. According to https://github.com/nicolasff/phpredis#flushdb it's always true, I've removed Always true comment in @return
@piteer1 I really like where this PR is going. I have a couple of small issues:
Thanks! |
* | ||
* @return Redis | ||
*/ | ||
public function getRedisResource() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should be
protected
- to get the redis resource theRedisResourceManager
should be used @return RedisResource
@Freeaqingme You can inject an existing redis resource using |
Thanks for the review, I will correct code later and answer all the questions. |
Redis converts everything to string. I think I misunderstood supportedDatatypes array. I've assumed that if the datatype is not preserverd it's not supported at all. I would like to claryfy things if it's possible. |
@Freeaqingme Yes it's like marc-mabe wrote, it's possible to set existing redis resource. |
@piteer1 The datatype array should tell the consumer how to handle different datatypes as follows:
Could you create a future request for phpredis with a description why we need this and a link to this PR please. |
'double' => 'string', | ||
'string' => true, | ||
'array' => 'string', | ||
'object' => 'string', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw in you tests redis converts this into a string without any any serializion. So this is useless for customers and arrays and objects are not supported false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry, by mistake I've commited this. It should be of course false
…edis Storage tests
This is still marked as WIP -- @marc-mabe -- is it ready to review for inclusion yet? |
@marc-mabe I hope all issues were corrected. I've also added request for phpredis to add a possibility to obtain all settings back from phpredis class. If this would be implemented then I will refactor |
@weierophinney @piteer It looks great 👍 |
[WIP] Redis cache storage
…s-cache-storage [WIP] Redis cache storage
New cache storage compatible with Redis. Heavily based on Memcached Storage.