- Issue created by @blazey
- Merge request !9815Issue #3480025: There is no way to remove entity cache items β (Closed) created by blazey
- Merge request !9816#3480025 Remove cache items from RAM when MemoryBackend::garbageCollection() is invoked. β (Open) created by blazey
- πΊπΈUnited States smustgrave
Thanks for reporting!
Will most likely need a test case showing this bug
Nice issue summary!
- π©πͺGermany tstoeckler Essen, Germany
Thanks for this, this is very helpful!
I have run into this issue lots of times and have come into the habit of copy-pasting the following stanza to various services in various projects for exactly this purpose:
protected static function reclaimMemory(): void { $memory_cache = \Drupal::service('entity.memory_cache'); assert($memory_cache instanceof MemoryCacheInterface); $memory_cache->deleteAll(); gc_collect_cycles(); }
I never figured out how to properly solve this issue, though, great work on that! Not sure how to write a test for this, as the concrete memory usage at any given point is always a bit unpredictable, but maybe someone will have an idea. Definitely bookmarking this and will give this a spin when I get a chance.