The function scandir() heavy?
This: folder with 5000-6000 images, which are constantly changing
If you want to choose a random picture, whether to use this feature?
July 9th 19 at 13:34
More answers about
"The function scandir() heavy?"
July 9th 19 at 13:36
use DirectoryIterator, it will be faster.
better yet, make a file Manager. So they're all somewhere casinopolis, and not requested every time you access the file system. for example in memcached to throw an array of files, or updating files to update and memcached'e. And for a sample you will not need to re-scan the directory and just pull the array from the cache and to select a random item. It will be even faster. Either store in the database, and to do the same thing using f-II DBMS.
commented on July 9th 19 at 13:39
Just to complicate caching and the database is not wanted at this stage. That is, I understand that the list of files we are receiving brute force of all elements in the directory? That is, the operating system has no ready-made list of files in a folder
commented on July 9th 19 at 13:42
maybe he is, but it is still necessary to consistently iterate
commented on July 9th 19 at 13:45
to write your answer or comment.
Find more questions by tags