The system.module declares file entity with 'static cache' = FALSE.
This results to the next behaviour when viewing a page with a file (using File Entity module):
1) The first call to the _menu_load_objects()
is loading a file from the database in DrupalDefaultEntityController->load()
, which never caches the result, since $entity->cache = FALSE
.
2) All subsequent calls to the _menu_load_objects()
(from _menu_translate()
for example, which is called oftenly), makes DrupalDefaultEntityController->load()
to load the entity again and again.
In my setup I see about 15 identical queries when viewing a page with single file entity. For example, every menu local task, makes a file to load again, since _menu_load_objects()
is called for every item.
Is this by design or what? What's wrong with making file entities 'cacheable'?