Closed tacman closed 4 weeks ago
Actually, since DirectoryListing is a generator, I expanded it to an array.
public function storageBrowser(FilesystemOperator $defaultStorage): Response
{
$images = $this->cache->get('directory', fn(CacheItem $item) =>
iterator_to_array($defaultStorage->listContents('/', deep: true))
);
return $this->render(...)
}
For the moment, I can't see any other way than to use the Symfony cache like the second comment. When I see this issue : https://github.com/thephpleague/flysystem/issues/1361, the built-in should be done in flysytem directly.
I want to minimize calls to S3 to get a large list which rarely changes.
Is there a way to configure a cache? Perhaps DirectoryListing can be serialized and I can use the Symfony cache, but I thought there might be a built-in way, especially since Version 1 of Flysystem had a cache adapter.
Thanks.