Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PropertyInfo] Cache support#16917

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

Closed
dunglas wants to merge6 commits intosymfony:masterfromdunglas:property_info_cache

Conversation

@dunglas
Copy link
Member

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16893
LicenseMIT
Doc PRtodo

Replace#16893 with several advantages:

@dunglasdunglas changed the title[PropertInfo] Cache support[PropertyInfo] Cache supportDec 9, 2015
@dunglasdunglasforce-pushed theproperty_info_cache branch 2 times, most recently from3d7efb2 to677b45dCompareDecember 9, 2015 07:23
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of passing the cache here I would prefer using composition instead which decorate the default PropertyInfoExtractor something likehttps://gist.github.com/aitboudad/12419c2db6d19320c5fa

Copy link
Contributor

Choose a reason for hiding this comment

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

same thing for#16838

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I was thinking the same thing initially, but finally I'm not sure that it's a good idea:

  • Performance (and cache) is not an "optional" feature. It should be enable for all implementations in prod and IMO it's why it belongs to this class.
  • In the context of the Standard Edition it adds a lot of complexity and an overhead: it requires to use the service decorator feature to switch the class depending of the environment (the cache must be enabled in prod, but not in dev)
  • In the context of the component, it makes it harder to enable the cache (one more class to instantiate)
  • all other components using cache doesn't use composition for that (it is considered as a builtin feature)

When the PSR-6 will be ready, the argument can even be made mandatory (it's better to always use a cache) and aNullCache or something like that can be added for the dev environment (like with the Logger).

What do you think @symfony/deciders?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Composition is much cleaner and should be used unless it is not possible, like with the property accessor cache.

@dunglas
Copy link
MemberAuthor

Switched to an implementation to a Decorator as requested. Should the decorator belong to the Doctrine Bridge? IMO no because when PSR-6 will be ready we will switch to this interface instead of Doctrine Cache but I'm open to suggestions. Same if you find a better name for the decorator.

@dunglas
Copy link
MemberAuthor

ping @symfony/deciders

Copy link
Member

Choose a reason for hiding this comment

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

double dots

@xabbuh
Copy link
Member

Looks like you need to rebase here (the namespace changes have been done in another PR).

@dunglas
Copy link
MemberAuthor

Rebased and typo fixed.

Choose a reason for hiding this comment

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

just wondering: $arguments contains $context. But what does $context contain? Is it a big or small array of scalars? Something potentially non-serializable there?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

For now it is only used in Symfony by the serializer extractor (a small array of strings). But it's a good concern because the context can be used by any custom extractor and can contain anything.

Do you know a way to easily retrieve an unique identifier from an array or should we try something like recursively replacing instances of objects by the return ofspl_object_hash()?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Maybe can we add a note in the doc of$context in interfaces that it should only contain scalar and serializable objects or it will create unexpected side effects?

It will avoid to add a costly (in term of performance) custom serialization process here.

@dunglas
Copy link
MemberAuthor

Committed a better way to handle context not serializable. /cc@nicolas-grekas

Copy link
Member

Choose a reason for hiding this comment

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

This is not really meaningful.

@dunglasdunglas mentioned this pull requestJan 17, 2016
2 tasks
@dunglas
Copy link
MemberAuthor

Status: needs work

Should be ported to PSR-6

@dunglas
Copy link
MemberAuthor

Status: Needs review

Moved to PSR-6.

Copy link
Member

Choose a reason for hiding this comment

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

"psr/cache-implementation": "For using the metadata cache.",?

@dunglas
Copy link
MemberAuthor

@fabpotsymfony/cache replaced bypsr/cache-implementation in suggest.

@fabpot
Copy link
Member

Thank you@dunglas.

@fabpotfabpot closed thisJan 27, 2016
fabpot added a commit that referenced this pull requestJan 27, 2016
This PR was squashed before being merged into the 3.1-dev branch (closes#16917).Discussion----------[PropertyInfo] Cache support| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#16893| License       | MIT| Doc PR        | todoReplace#16893 with several advantages:- Less complex patch- Work for all usages of PropertyInfo (even outside of the Serializer)- Avoid a circular reference between Serializer's CallMetadataFactory and PropertyInfo's SerializerExtractor- Allow@mihai-stancu's#16143 to work as-isCommits-------86c20df [PropertyInfo] Cache support
@dunglasdunglas deleted the property_info_cache branchJanuary 27, 2016 07:12
Copy link
Contributor

Choose a reason for hiding this comment

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

setUp is a protected method

Copy link
Contributor

Choose a reason for hiding this comment

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

Quick search revealed there's few more occurrences. I'll send a PR to fix them.

@fabpotfabpot mentioned this pull requestMay 13, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@dunglas@xabbuh@fabpot@jakzal@nicolas-grekas@Tobion@sstok@aitboudad@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp