1

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?

zion
  • 51
  • 1
  • 3
  • 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

1 Answers1

1

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).

Smudge
  • 24,039
  • 15
  • 57
  • 76