Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Moving cache files to memory

move files into tmpfs

11:29 am on Apr 21, 2011 (gmt 0)

Full Member

10+ Year Member

joined:Jan 21, 2005
posts: 298
votes: 2

I recently bumped into a blog post where the person suggested to move the cache files to memory. My website creates cache files in html format and stores them on disk. With this method the folder is moved to memory apparently. It has significantly reduced the memory usage strangely.

Is this correct?

mount -t tmpfs -o size=1G,nr_inodes=10k,mode=0777,noatime,nodiratime tmpfs /path/to/cache/folder
12:08 pm on May 3, 2011 (gmt 0)

Full Member

5+ Year Member

joined:May 31, 2008
votes: 1

I'm doing the same thing too in my /etc/fstab file, one example is:

tmpfs /var/cache/apache2/mod_disk_cache tmpfs defaults,noatime 0 0

Works like a charm for all kinds of temporary files.
A reboot will clear them.