Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.