Doctrinal二级关联缓存未命中

时间:2015-05-13 01:40:58

标签: symfony caching doctrine-orm second-level-cache

---------------------

User Entity:

/**
 * User
 *
 * @ORM\Table()
 * @ORM\Entity()
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE")

// ....

/**
 * Cars of the user.
 *
 * @var ArrayCollection
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
 * @ORM\OneToMany(targetEntity="Acme\CarBundle\Entity\Car", mappedBy="user")
 */
protected $cars;

----------------------

Car Entity:

 * @ORM\Entity()
 * @ORM\Table()
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE")

// ...

/**
 * Owner of the car
 *
 * @var UserInterface
 *
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
 * @ORM\ManyToOne(targetEntity="Acme\UserBundle\Entity\User", inversedBy="cars")
 * @ORM\JoinColumn(referencedColumnName="id")
 */
protected $user;

问题是,acme_userbundle_entity_user__cars永远不会点击缓存,但每次都会把它放入..

二级缓存:

acme_carbundle_entity_car           cache hits: 8 // OK

acme_userbundle_entity_user           cache hits: 6 // OK

acme_userbundle_entity_user__cars    cache misses: 1 // WHY?

acme_userbundle_entity_user__cars    cache puts: 1 // WHY?

0 个答案:

没有答案