Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0#18823
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| if ('N;' === $value) { | ||
| $value = null; | ||
| } elseif (isset($value[2]) && is_string($value) && ':' === $value[1]) { |
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.
is_string should come beforeisset($value[2]) IMO
1f8c746 tod9328e2Compare| } | ||
| } | ||
| $dump = <<<EOF |
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 enclosed with nowdoc instead of heredoc.
| */ | ||
| class NullAdapter implements AdapterInterface | ||
| { | ||
| private $createCacheItem; |
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.
phpdoc missing
928dc61 toc6e08fcComparetgalopin commentedMay 25, 2016
I did the changes |
| EOF; | ||
| foreach ($values as $key => $value) { | ||
| CacheItem::validateKey($key); |
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.
because PHP casts numeric string keys to ints, we should cast ints to string here:
`is_int($key) ? (string) $key : $key);
| $fallbackKeys = array(); | ||
| foreach ($keys as $key) { | ||
| if (!is_string($key)) { |
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 check should be done before calling generateItems
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.
indeed. Doing it in the generator will throw the exception too late (the iterator will throw it during iteration, while it must be throw by getItems)
nicolas-grekas commentedMay 26, 2016
I suggest renaming this adapter to Php7Adapter (ans use the OpcacheAdapter name in#18894) |
tgalopin commentedJun 27, 2016
I did some benchmarks to check the PHP 5.6 support in this PR. I used three Docker containers with only PHP/HHVM installed, on the same host. I used Apache Benchmark with 1000 requests at a concurrency of 100 ( The results are the following:
This seems to indicate that having an array filled with data in PHP 5.6 is significantly slower than having an empty array. Therefore, I removed the PHP 5.6 support for this PhpArrayAdapter in the |
nicolas-grekas commentedJun 27, 2016
👍 |
bb8e068 toc507cc0Comparedunglas commentedJun 27, 2016
👍 |
| try { | ||
| $value = serialize($value); | ||
| } catch (\Exception $e) { | ||
| throw new InvalidArgumentException(sprintf('Cache key "%s has non-serializable %s value', $key, get_class($value)), 0, $e); |
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.
Missing closing double quote.
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.
Also missing a dot at the end.
tgalopin commentedJun 28, 2016
I did the changes. |
| private $fallbackPool; | ||
| /** | ||
| * @param string $file The PHP file were values are cached. |
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.
tgalopin commentedJun 28, 2016
I did the change |
fabpot commentedJun 28, 2016
Thank you@tgalopin. |
…P 7.0 (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | WIP| Fixed tickets | -| License | MIT| Doc PR | -Depends on#18825This PR aims to implement a Symfony Cache adapter able to build files optimized for OPCache memory storage. Any kind of static data that can be warmed up is a candidate for OPcache storage.This PR is limited to the implementation of the Adapter. It's usage in the annotations caching system is implemented in the PR#18533. The aim is also to use this adapter in other contexts (validator, serializer, ...).Commits-------28a40d2 [Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0+
…e warmer for annotations (tgalopin)This PR was squashed before being merged into the 3.2-dev branch (closes#18533).Discussion----------[FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | WIP| Fixed tickets | -| License | MIT| Doc PR | -Depends on#18825 and#18823This PR implements the usage of the new OpCacheAdapter in the annotations caching system. The idea to use this adapter as much as possible in Symfony (validator, serializer, ...). These other implementations will be the object of different PRs.Commits-------f950a2b [FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations
…e warmer for annotations (tgalopin)This PR was squashed before being merged into the 3.2-dev branch (closes #18533).Discussion----------[FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | WIP| Fixed tickets | -| License | MIT| Doc PR | -Depends onsymfony/symfony#18825 andsymfony/symfony#18823This PR implements the usage of the new OpCacheAdapter in the annotations caching system. The idea to use this adapter as much as possible in Symfony (validator, serializer, ...). These other implementations will be the object of different PRs.Commits-------f950a2b [FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations
…e warmer for annotations (tgalopin)This PR was squashed before being merged into the 3.2-dev branch (closes #18533).Discussion----------[FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | WIP| Fixed tickets | -| License | MIT| Doc PR | -Depends onsymfony/symfony#18825 andsymfony/symfony#18823This PR implements the usage of the new OpCacheAdapter in the annotations caching system. The idea to use this adapter as much as possible in Symfony (validator, serializer, ...). These other implementations will be the object of different PRs.Commits-------f950a2b [FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations
…e warmer for annotations (tgalopin)This PR was squashed before being merged into the 3.2-dev branch (closes #18533).Discussion----------[FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | WIP| Fixed tickets | -| License | MIT| Doc PR | -Depends onsymfony/symfony#18825 andsymfony/symfony#18823This PR implements the usage of the new OpCacheAdapter in the annotations caching system. The idea to use this adapter as much as possible in Symfony (validator, serializer, ...). These other implementations will be the object of different PRs.Commits-------f950a2b [FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations
…weaverryan)This PR was merged into the 3.2 branch.Discussion----------Covering two missing Cache adapters introduced in 3.2Hi guys!These are 2 missing adapters that were introduced in 3.2!symfony/symfony#18894 andsymfony/symfony#18823Cheers!Commits-------a3e69e2 Tweaks based on feedback!1b6cb69 Covering two missing adapters introduced in 3.2
Uh oh!
There was an error while loading.Please reload this page.
Depends on#18825
This PR aims to implement a Symfony Cache adapter able to build files optimized for OPCache memory storage. Any kind of static data that can be warmed up is a candidate for OPcache storage.
This PR is limited to the implementation of the Adapter. It's usage in the annotations caching system is implemented in the PR#18533. The aim is also to use this adapter in other contexts (validator, serializer, ...).