Skip to content

[Serializer] Add PSR-6 cache on $discriminatorCache #29878

@franek

Description

@franek

Description
@fbourigault has done a great job in order to Reduce class discriminator overhead with Symfony 4 (#28889). Nevertheless, it would be nice if $discriminatorCache implements PSR-6 cache. Cache will be populate on the first request and all other requests, will use the cache.

class ObjectNormalizer extends AbstractObjectNormalizer
{
    protected $propertyAccessor;

/** Replace array by a PSR-6 implementation */
    private $discriminatorCache = array();

    public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null)
    {
...
    }

Do you think it is a good idea to work on this feature ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions