Memoization is a way to cache the results of calling a function with a specific set of parameters. This can be very useful in Drupal if you need to call a function that does some kind of complex computation or database queries, but is in a part of the code you don’t want to modify. Here is a function I wrote for a recent project that allows you to utilize this technique:
And here are some examples of how you might use it:
Be warned, however. You only want to do this if you know for sure that you are going to call a function more than once. Otherwise it’s just added overhead with no benefit.
My name is Aaron Forsander and I have a blog. 





Track comments via RSS 2.0 feed. Feel free to post the comment, or trackback from your web site.
Currently there are no comments related to article "Drupal and Memoization".