[TYPO3-50-general] Cache problem in Extbase with reflection data
Robert Lemke
robert at typo3.org
Tue Aug 4 12:38:08 CEST 2009
Hi Jungs,
Am 04.08.2009 um 12:02 schrieb Bastian Waidelich:
>> i discovered a problem with the cache of reflection data.
>
> Just to make this a bit clearer. This is about
>
> F3\FLOW3\Reflection\Service::saveToCache()
> (Tx_Extbase_Reflection_Service::saveToCache() in Extbase)
>
> There we have a call
> $this->cache->set('ReflectionData', $data);
>
> AFAIK in FLOW3 this is called once for all active packages. In Extbase
> this is probably not possible, so we need to store some extension
> identifier with the reflection data.
>
> On the other hand we might be able to add only new reflection data to
> the cache instead of overwriting anything!?
Without looking at the Extbase implementation ... here's how it
basically
work in FLOW3:
- on each request the reflection framework checks (very early) if
cached
data is available
- if yes: load reflection data (about all classes) from cache
- if not: reflect all classes which are _currently declared_
- each time the reflection service's methods are called they check if
the class in question has been reflected already
- if yes: use the cached information already loaded earlier
- if not: reflect the new class and return the information
- at the end of each request the reflection framework checks if any
new
classes have been reflected since the data has been loaded from
cache
- if yes: save the new reflection data (ie. everything again)
- if not: nothing to do
- the overall reflection data cache entry is only flushed if
"something
radical" happens
- if a single class file changes, this is detected by the file monitor
which flushes all cache entries tagged with the class name
- on the next run the reflection service detects which classes have
changed
and therefore need to be re-reflected. By this we avoid reflecting
all
classes again only because a few have changed.
If you haven't yet, just look at FLOW3's class \F3\FLOW2\Reflection
\Service,
that should explain much ...
cheers,
robert
More information about the TYPO3-project-5_0-general
mailing list