Skip to content

[Cache] Memcached Adapter Docs and Cache Pool Docs Refactoring #7265

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

Merged
merged 4 commits into from
Mar 13, 2017

Conversation

robfrawley
Copy link
Contributor

Documentation for symfony/symfony#20863 and symfony/symfony#20858. PR symfony/symfony#20863 is still being written/finalized, so this is a WIP following that PR at this time. Resolves #7256.

@robfrawley
Copy link
Contributor Author

Test failure unrelated to this PR: https://travis-ci.org/symfony/symfony-docs/builds/184129616#L215

@robfrawley robfrawley force-pushed the feature-advanced-memcached-cache-pool branch from 303091c to 5a38c70 Compare December 17, 2016 19:12
@robfrawley robfrawley changed the title [Cache] [WIP] Advanced Memcached Adapter Docs [Cache] Advanced Memcached Adapter Docs Dec 17, 2016
@robfrawley
Copy link
Contributor Author

robfrawley commented Dec 17, 2016

Assuming symfony/symfony#20863 is merged as-is, documentation is up-to-date. Refactored the adapter pool docs to move them into separate files (they haven't otherwise been edited aside from a link to DSN in the Redis adapter and correcting the spacing in the index definition of the cache files), as the document became very, very long with the detailed Memcached adapter docs added.

@robfrawley robfrawley force-pushed the feature-advanced-memcached-cache-pool branch from 5a38c70 to 56cc20d Compare December 17, 2016 19:56
@robfrawley robfrawley changed the title [Cache] Advanced Memcached Adapter Docs [Cache] Advanced Memcached Adapter Docs and Cache Pool Docs Refactoring Dec 17, 2016
@robfrawley robfrawley changed the title [Cache] Advanced Memcached Adapter Docs and Cache Pool Docs Refactoring [Cache] Memcached Adapter Docs and Cache Pool Docs Refactoring Dec 17, 2016
@xabbuh xabbuh added this to the 3.3 milestone Dec 30, 2016
@robfrawley robfrawley force-pushed the feature-advanced-memcached-cache-pool branch 3 times, most recently from a0eae02 to 703aa32 Compare December 31, 2016 17:43
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Dec 31, 2016

Great work! Instead of listing the options, I wonder if we shouldn't link to the php doc. If we could expand to the same level the redis section, it could be great to have them on parity.

@robfrawley
Copy link
Contributor Author

robfrawley commented Dec 31, 2016

Regarding Redis: I'll give that a look and update it in-line with Memcached adapter; sure.

As for the Memcached options, I'm split on this. The original copy didn't have options, and later they were added for a few reasons. First, the PHP manual includes invalid options, like cache_lookups (and more), which will cause a deprecation exception to be thrown by the extension. Second, the PHP manual is missing options, like randomize_replica_read (and more). Third, the PHP manual doesn't do a great job of making it obvious what are option names and what are option values. Lastly, I tried to provide better descriptions, especially where a description was completely absent, but also where it was simply ambiguous or badly written.

Which is what led to the inclusion of options in the Symfony docs.

@nicolas-grekas Given the above, do you still think we should just link to the PHP manual? It should be noted that I still do link to the manual as the last line of the documentation.

@nicolas-grekas
Copy link
Member

Reasonable :) let's see what the docs core team thinks about it, maybe there is some existing practice on the topic.
I may have missed it, but we should tell that v2.2 or higher is required btw!

@robfrawley
Copy link
Contributor Author

Good catch (re version requirement). Will add.

symfony-splitter pushed a commit to symfony/cache that referenced this pull request Jan 4, 2017
… to MemcachedAdapter (nicolas-grekas, robfrawley)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Cache] Add DSN, createClient & better error reporting to MemcachedAdapter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#7265

Replaces #20863
ping @robfrawley: would you mind opening a doc PR for this?

Commits
-------

87030b4 [cache] Add tests for MemcachedAdapter::createClient()
e109438 [Cache] Add DSN, createClient & better error reporting to MemcachedAdapter
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Jan 4, 2017
… to MemcachedAdapter (nicolas-grekas, robfrawley)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Cache] Add DSN, createClient & better error reporting to MemcachedAdapter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#7265

Replaces #20863
ping @robfrawley: would you mind opening a doc PR for this?

Commits
-------

87030b4 [cache] Add tests for MemcachedAdapter::createClient()
e109438 [Cache] Add DSN, createClient & better error reporting to MemcachedAdapter
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jan 4, 2017
… to MemcachedAdapter (nicolas-grekas, robfrawley)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Cache] Add DSN, createClient & better error reporting to MemcachedAdapter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#7265

Replaces #20863
ping @robfrawley: would you mind opening a doc PR for this?

Commits
-------

87030b4 [cache] Add tests for MemcachedAdapter::createClient()
e109438 [Cache] Add DSN, createClient & better error reporting to MemcachedAdapter
optional username and password (for SASL authentication; it requires that the
memcached extension was compiled with ``--enable-memcached-sasl``) and an
optional weight (for prioritizing servers in a cluster; its value is an integer
between ``0`` and ``100`` which defaults to ``XX``; a higher value means more
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're missing the default value of weight: 0? 50?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, there isn't really a "default" for this value. If a weight isn't set, all servers are treated exactly the same. We don't provide any default weight when one isn't specified. How do you think we should make that clear and word it?

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robfrawley thanks for contributing this massive PR. I've reviewed it carefully and I'm 👍

In 68dc310 I've made some minor simplifications and I've sorted the options alphabetically and updated its syntax to use the reStructuredText definition lists (that's why the changes look bigger than they really are).

@robfrawley
Copy link
Contributor Author

robfrawley commented Jan 13, 2017

@javiereguiluz Thanks for taking a look and reviewing this PR; I won't have time to update this PR until the coming weekend. You can expect me to address any comments you made, as well as expand the Redis section. I'll be sure to submit something before the end of the weekend, and then this should likely be merged ASAP, as all related PRs have been finalized and submitted into the Symfony codebase already. I'll let you and @nicolas-grekas know when this needs a final review. Thanks!

@robfrawley
Copy link
Contributor Author

@nicolas-grekas Finished the section pertaining to Redis connection options (see the platform.sh build). Feel free to advise me if you require additional changes.

@javiereguiluz Did some rebasing to clean this up a bit; let me know if I should squash or otherwise edit the commit history prior to the PR's merger.

This should be ready!

@nicolas-grekas
Copy link
Member

Doc what the default "persistent_id" is when only persistent is set? (I don't remember myself)

@robfrawley
Copy link
Contributor Author

robfrawley commented Jan 24, 2017

@nicolas-grekas Didn't look like that was the case when I gave it a once-over

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/RedisTrait.php#L105

Please correct me if I am wrong and should add something about persistend_id only applying when persistent is enabled, but it doesn't look like that is the case to me.

@robfrawley
Copy link
Contributor Author

Erm, nevermind, misread your comment. The default is null.

That said, the behavior looks different for \Redis and \Predis\Client: with \Redis it will enable persistent connections if either persistent or persistent_id is set, but with Predis\Client it just blindly passes the parameters. Does that client behave similarly?

@robfrawley robfrawley force-pushed the feature-advanced-memcached-cache-pool branch from 0a8ee1f to 0213bc0 Compare January 25, 2017 15:19
@robfrawley
Copy link
Contributor Author

Is this good to go, or do I need to do anything prior to merge?

@xabbuh
Copy link
Member

xabbuh commented Feb 8, 2017

@robfrawley Can you resolve conflicts here?

@robfrawley robfrawley force-pushed the feature-advanced-memcached-cache-pool branch 2 times, most recently from 357b2dc to c49d427 Compare February 8, 2017 15:44
@robfrawley
Copy link
Contributor Author

@xabbuh rebased

This adapter is a high-performance, shared memory cache. It can increase the
application performance very significantly because the cache contents are
stored in the shared memory of your server, a component that is much faster than
others, such as the file system.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filesystem


.. tip::

Note that this adapters CRUD operations are specific to the PHP SAPI it is running
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adapter's


.. note::

When an item is not found in the first adapters but is found in the next ones, this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] first adapter [...]

adapter ensures that the fetched item is saved in all the adapters where it was
previously missing.

The following shows how to create a chain adapter instance using the fastest and slowest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following example [...]

@robfrawley
Copy link
Contributor Author

@xabbuh fixes pushed

@xabbuh
Copy link
Member

xabbuh commented Feb 8, 2017

👍

Status: Reviewed

@robfrawley
Copy link
Contributor Author

robfrawley commented Feb 16, 2017

@javiereguiluz @xabbuh Anything else you guys want me to do for this PR? This should likely be merged sooner than later, as (aside from the general cleanup and expansion of adapter docs) it provides the initial documentation for the Memcached feature, which has been live on master for over a month.

Additionally, as this PR reorganizes and moves all the adapter docs into their own pages, it will continue to have merge conflicts when anyone so much as touches the adapter docs, and I'd appreciate not having to rebase this PR over and over. ;-)

All the best.

@xabbuh
Copy link
Member

xabbuh commented Feb 26, 2017

👍 Let's merge this.

@javiereguiluz Anything else from your side?

@javiereguiluz
Copy link
Member

@xabbuh nothing else from me ... just thanking @robfrawley again for his amazing work here!

@robfrawley
Copy link
Contributor Author

robfrawley commented Feb 26, 2017

Thanks for the reviews as well, guys. Symfony is absolutely the best community to be involved in, and you guys do an amazing job maintaining the respective aspects of the project you contribute to @nicolas-grekas, @javiereguiluz, and @xabbuh!

@xabbuh
Copy link
Member

xabbuh commented Mar 13, 2017

Thank you @robfrawley.

@xabbuh xabbuh merged commit 7db929c into symfony:master Mar 13, 2017
xabbuh added a commit that referenced this pull request Mar 13, 2017
…ctoring (robfrawley, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

[Cache] Memcached Adapter Docs and Cache Pool Docs Refactoring

Documentation for symfony/symfony#20863 and symfony/symfony#20858. PR symfony/symfony#20863 is still being written/finalized, so this is a WIP following that PR at this time. Resolves #7256.

Commits
-------

7db929c corrected spelling/grammar
c49d427 cleanup all cache adapter documentation, extend redis docs
e3eff5b Reviewed the entire article
d4292b7 refactor cache pool documentation and add memcached adapter docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants