Reputation: 1109
Does PHP cached content of required files or every time they read from disk? I know there is tools like APC but I want to know is PHP smart enough to do something like this?
If it's so then how PHP track changes or know when a file needs to be cached again?
Edit:
How do I know my files is cached?
Thanks
Upvotes: 0
Views: 560
Reputation: 13283
It depends on your system:
PHP can be configured to cache PHP files. Using something like APC you can even configure it to only read a file once and then never look at it again (by default it stats the file to see if it has changed).
Most operating systems cache frequently accessed files. They are often very good at doing this, so you should not worry too much about file access slowing down your code. You should really only look at this if you actually have measurable problems with disk access being slow.
Some hard disks will cache frequently used files/data in high-speed built-in memory, in order to make them more responsive. Hybrid drives a good example of this.
If you are using an SSD then, well, all this becomes irrelevant.
Upvotes: 1