Skip to content

[CssSelector] Added cache on top of CssSelectorConverter #35425

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 1 commit into from
Jan 27, 2020

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Jan 21, 2020

Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

@nicolas-grekas nicolas-grekas added this to the next milestone Jan 21, 2020
@stof
Copy link
Member

stof commented Jan 22, 2020

should we use 2 static properties for the cache, or an instance property ?

@stof
Copy link
Member

stof commented Jan 22, 2020

Also, the code may be simpler if we define an instance-level cache property, being a reference to either self::$xmlCache or self::$htmlCache. This way, only the constructor needs to know about the 2 separate caches.

@lyrixx
Copy link
Member Author

lyrixx commented Jan 22, 2020

A New crawler is instanced on each method call (for the results). Then each time you call filter() a new css selector converter is instansiated. That's why the cache is static

I will implement your last idea 👍

@lyrixx lyrixx force-pushed the css-cache branch 2 times, most recently from edec12f to bdc121c Compare January 22, 2020 12:49
@fabpot
Copy link
Member

fabpot commented Jan 27, 2020

Thank you @lyrixx.

fabpot added a commit that referenced this pull request Jan 27, 2020
…er (lyrixx)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[CssSelector] Added cache on top of CssSelectorConverter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

ed11d52 [CssSelector] Added cache on top of CssSelectorConverter
@fabpot fabpot merged commit ed11d52 into symfony:master Jan 27, 2020
@lyrixx lyrixx deleted the css-cache branch January 27, 2020 16:12
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
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.

6 participants