0

I'm using PHP's APC user-cache to cache some database results, e.a. loading a few smaller tables into APC. The reson I'm doing it is to reduce Mysql load and connections.

In my case there is a trade-off: either a few variables each with larger data arrays, or some thousands of variables with smaller data.

Example: 3000 variables each with 500 bytes, or 3 variables with 500 Kbyte. Which of those is faster/better?

Roland
  • 1

1 Answers1

0

In theory, having a key for every cache object would increase ram usage, but 1.5mb of data is really not a lot. However, cache is used to speed up processing time, at which you'd want to minimize that where you can.

If you're saving/retrieving data you don't use in the 500kbyte set, you're better off using 3000 variables each 500 bytes to save processing time. If you're only using a small portion of the 500kb, you shouldn't process the full 500kb.

Jon Skarpeteig
  • 4,118
  • 7
  • 34
  • 53