I'm working on a method that, due to the expense of it's operation and frequency which it is called with identical arguments, would benefit from caching the return values.
I'll be serialize()
-ing the arguments together for cache keys, but this can result in very long keys, due to the lengthy array arguments.
- Does PHP array indexing and look-up suffer from such long keys (think from 250B to 1kB+)?
- So far so good, but am I facing a situation where this could fail spectacularly on me at some point?
- Basically, should I
md5()
(or alternative) the keys?
Minor clarifications:
This is only per-request caching, with no permanent storage. The method in question is that of a view helper, and for each view generation it may be called 500 times or more.