I don’t know about you, but I always get a bit excited when I get to use PHP’s magic methods.
Here’s an implementation I did at work for a class which contains multiple functions whose result needs to only be “calculated” every few minutes, but the results could be retrieved many times by different people within that period ( i.e. the functions are “cachable” ).
2 thoughts on “An OO PHP implementation of a collection of cachable functions”
Here is also convenient way to cache function calls. If you create abstract class with __call, it’s possible to make any existing method call cacheable just by extending from abstract
Ah, interesting. Thanks Sergey!