V
V
v- death2015-08-04 14:50:01
PHP
v- death, 2015-08-04 14:50:01

What is the best way to store a cache of "compiled" pages?

Good afternoon. I made a kind of template engine. At the moment, it compiles the template with the help of regular expressions (for example, instead of a bunch of includes, everything is collected in 1 file, all spaces between tags are cut out, etc. in the next page updates, the template is removed from the cache, and not compiled)
At the moment, the cache is stored by "microsoft" scheme (md5 and a bunch of folders depending on the first characters of md5)
Now I think that it is possible if you put it in a phar archive, then the load on the file system will be less.
What do you think?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2015-08-04
@vGrabko99

If there are less than 1000 files in the folder, no md5 files are needed.
If there are less than a few thousand folders, no optimizations are needed.
phar in any way will be slower, because reading from disk and unpacking a huge container will consume a lot of resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question