Skip to content

storages: added PeclMemcachedStorage using pecl-memcached extension#38

Closed
hrach wants to merge 1 commit into
nette:masterfrom
hrach:memcached
Closed

storages: added PeclMemcachedStorage using pecl-memcached extension#38
hrach wants to merge 1 commit into
nette:masterfrom
hrach:memcached

Conversation

@hrach

@hrach hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor

PHP 7.0 has only memcached extension available.

@hrach hrach force-pushed the memcached branch 4 times, most recently from 22bb465 to d0de70f Compare February 18, 2016 08:28
{
if ($this->memcache->addServer($host, $port, 1) === FALSE) {
$error = error_get_last();
throw new Nette\InvalidStateException("Memcached::addServer(): $error[message].");

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

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.

@hrach hrach force-pushed the memcached branch 3 times, most recently from 2f929cd to ee5ace3 Compare February 18, 2016 09:31
@hrach

hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

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)

@dg

dg commented Feb 18, 2016

Copy link
Copy Markdown
Member

Both are PECL and both are for Memcached, how they differs?

@hrach

hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

Memcached is newer, maintained and updated for PHP7, also has richer API.


Ad naming:
You have once mentined that the class name is not a name of the extension but the storage name. But in this case there is not sultion to solve it, so I suggest:

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

@JanJakes

Copy link
Copy Markdown

Memcache extension is not packaged for PHP7 neither by https://www.dotdeb.org/ nor by ppa:ondrej/php. Therefore current MemcachedStorage implementation in Nette can be considered incompatible with PHP7.

@dg

dg commented Feb 18, 2016

Copy link
Copy Markdown
Member

"Pecl" is really not nice, because everything is pecl…

@hrach

hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

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.

@dg

dg commented Feb 18, 2016

Copy link
Copy Markdown
Member

But there is incompatibility… http://php.net/manual/en/book.memcache.php#115666 or not?

@hrach

hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

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.

@hrach

hrach commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

@hrach

hrach commented Feb 19, 2016

Copy link
Copy Markdown
Contributor Author

@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.

@milo

milo commented Feb 19, 2016

Copy link
Copy Markdown
Member

BC break can be solved by prefixing key. What about to hide Memcache and Memcached into one storage?

@hrach

hrach commented Feb 19, 2016

Copy link
Copy Markdown
Contributor Author

@milo I don't think it's a good idea. It's pretty common to reuse the connection returned by getConnection.

@dg

dg commented Feb 19, 2016

Copy link
Copy Markdown
Member

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.

@hrach

hrach commented Feb 19, 2016

Copy link
Copy Markdown
Contributor Author

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 :)

@dg

dg commented Feb 19, 2016

Copy link
Copy Markdown
Member

Yes, naming things is hard.

I don't like Pecl because it says nothing about how they differ. Moreover they both are PECL.

New extension uses libMemcached, so what about LibMemcached?

@hrach

hrach commented Feb 22, 2016

Copy link
Copy Markdown
Contributor Author

Thanks. 👍

@hrach hrach deleted the memcached branch November 21, 2016 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants