The Linux system provides us with the Tmpfs file system, TMPFS can use the memory directly, and use the swap partition to store it when there is not enough memory. It is also important to note that the TMPFS does not have persistence, the data is not retained after reboot, it must be noted, but we only use it to store the cache file, even if the file is lost does not affect the site access, completely risk-free.
/dev/shm/is a device file that uses the Tmpfs file system (note: Under CentOS and Redhat, the/DEV/SHM directory is a link to the/RUN/SHM directory, which corresponds to the Tmpfs file system under the Ubuntu system/run/ SHM directory, you can use the DF command to view), because/dev/shm/this directory is not on the hard disk, but in memory, it is called TMPFS. By command df-h See, tmpfs default size is half of physical memory, of course, can also be adjusted according to the actual situation.
First, create a directory for the wordpress cache file Wpcache
# Mkdir/dev/shm/wpcache
Granting read and Write execution permissions
# chmod 1777/dev/shm/wpcache
Mount Tmpfs to the/cache directory generated by the WordPress cache plugin
# Mount--bind/dev/shm/wpcache/home/wwwroot/amznz.com/wp-content/cache
# Ls-ld/dev/shm/wpcache
Returns a description similar to the following for Mount success
DRWXRWXRWT 3 www www. 22:50/dev/shm/wpcache
The cache plug-in now rebuilds the static paging file, and after a while, the command
# df-h
You can find out the usage of TMPFS.
Site Cache faster than Memcache