[TYPO3-mvc] Persistence object caching

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri May 20 02:12:23 CEST 2011


Hey,

> I just faced a weird problem with caching of persistence objects in
> extbase. When an object is queried for the first time, extbase keeps a
> copy of it in memory. That means when the same object is queried again
> in the same PHP session extbase returns the copy kept in memory rather
> than making a new one. This has some implications. If the object's data
> is modified in database by some other PHP session triggered after the
> first query then the changes won't reflect in existing PHP sessions.
> This is exactly what happened with me.
>
> While debugging I noted that extbase do fetch the data from database for
> every query but doesn't use it if there already exists a copy of the
> object in memory.

That can only happen if you modify the data of the object outside of 
Extbase (directly via SQL). If that's the case you should remove the 
object from the identityMap of the persistenceLayer in order to get a 
new version of it from the repository. But note that any already 
existing copy of the object will still hold the old data though (there 
is no instant update).

May I ask why there might be changes applied via RAW sql the object 
itself doesn't know about during it's lifecycle?

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list