Improve performance of the metadata system#1256
Conversation
|
|
||
| private function generateCacheKey(string $resourceClass = Dummy::class) | ||
| { | ||
| return CachedResourceMetadataFactory::CACHE_KEY_PREFIX.md5(serialize([$resourceClass])); |
There was a problem hiding this comment.
@teohhanhui you had a good reason to serialize here? (I think it comes from you)
Do we really need the md5 thing?
There was a problem hiding this comment.
This is necessary because the key must not exceed 64 chars (PSR-6). A long class name may exceed this.
|
Nice one! We may want to add the same thing to /edit: Maybe CachedIdentifiersExtractor is only available in master. |
|
I missed |
|
|
||
| private $cacheItemPool; | ||
| private $decorated; | ||
| private $memoryCache = []; |
There was a problem hiding this comment.
$memoryCache is not a very descriptive name... 😞
Perhaps $localCache and $localCacheKey. Descriptive is better.
There was a problem hiding this comment.
@teohhanhui however it's exactly what it is, a memory cache.
There was a problem hiding this comment.
APCu is also a (shared) memory cache. This is the local memory cache. 😆
There was a problem hiding this comment.
The word memory is just redundant and meaningless since all the variables are in memory anyway...
Improve performance of the metadata system
By default, the Symfony's
cache.systemsetup uses apcu. Our metadata component relies on this cache, however, as we retrieve the cache many time in a single requestapcu_fetchis called many times and do a lot of IO. This fix introduce a local memory cache to avoid the IO operations.