Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which will be faster and best option? Page will load faster with fwrite or memcached cached function? I need to store some functions in cache, they will not update very often, so need only to read it. Which one will be best option?

share|improve this question
Not very clear what you are referring to here, or what language. Can you please provide more details? – mfarver May 29 '11 at 20:19
Updated topic - php language. What details? If i store data with fwrite in .txt file, or i store data in memcache, which one will be better and why? – zion May 29 '11 at 20:22

Memcache, by about 1000x

Memcached works by storing objects in RAM, if you were to fwrite the data it would be stored on a disk so you'd get disk performance. If possible, always go for Memcached over disk/file storage and make sure you change your memcached config to use a decent amount of ram (By default it'll only use 1GB so if you've got a decent server you can upgrade it a bit, I wouldn't give it more than 75% of your ram but a good chunk).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.