-
-
Notifications
You must be signed in to change notification settings - Fork 44
storages: added PeclMemcachedStorage using pecl-memcached extension #38
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
Conversation
22bb465
to
d0de70f
Compare
{ | ||
if ($this->memcache->addServer($host, $port, 1) === FALSE) { | ||
$error = error_get_last(); | ||
throw new Nette\InvalidStateException("Memcached::addServer(): $error[message]."); |
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.
Isn't it dangerous? It can kill app when unfortunately fail.
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.
Well,
- app without cache actually can kill the server, not only one request
- this is copy & past & modify from the current MemcachedStorage.
2f929cd
to
ee5ace3
Compare
Tests are green. the question is. should we do something with the naming. (eg. renamed MemcachedStorage to PeclMemcacheStorage (note the missing D) and create deprecated class that inherits it) |
Both are PECL and both are for Memcached, how they differs? |
Memcached is newer, maintained and updated for PHP7, also has richer API. Ad naming: Renamed the current MemcachedStorage to PeclMemcacheStorage (note the missing D) and create deprecated class that inherits it with the old one name. So this storage will be an exception, where the storage implementation names are based on the extension name |
Memcache extension is not packaged for PHP7 neither by https://www.dotdeb.org/ nor by |
"Pecl" is really not nice, because everything is pecl… |
We be make a BC break, rename the old one to the MemcacheStorage, and in the new one trhow better exception if memcache exception is loaded and not the memcached. |
But there is incompatibility… http://php.net/manual/en/book.memcache.php#115666 or not? |
I wrote it's a BC break. Nobody claims these storages are interchangeable. Even there is a BC break in memcached 5.6 & 7.0 - they have changed the default serializer. |
For the naming, we can be inspired by Doctrine: https://github.com/doctrine/cache/tree/e0ef9e9833ca024d251e77e8d82a00ca92b0aa71/lib/Doctrine/Common/Cache |
@dg, please, let's collaborate your real objections and discuss them now. I have no intention to let this open for months or years, in that case I would do an extension instead. But I strongly believe, this should be in the core/package. |
BC break can be solved by prefixing key. What about to hide |
@milo I don't think it's a good idea. It's pretty common to reuse the connection returned by getConnection. |
To rename current MemcachedStorage is imho not needed, it will be removed in next Nette (for PHP 7), or it can be replaced with this storage. Currently we can use name as NewMemcachedStorage or something similar. It is like mysql & mysqli. |
If it's temporary, I like PeclMemcached more. But no objections to NewMemcachedStorage. Better something than nothing. So, pick a name, I will rename it and rebase it :) |
Yes, naming things is hard. I don't like New extension uses libMemcached, so what about LibMemcached? |
Thanks. 👍 |
PHP 7.0 has only memcached extension available.