in reply to How to test caching?

Yuck, prototypes.

Memoize is an interesting proof of concept, but it is so easy to do simple caching like this that I find no use for it. If I had a candidate for memoization that had many different patterns of parameters or possible return contexts, I might consider it. But even then, you can do a whole lot of stuff in the time taken by Memoize's overhead so I'd want to see benchmarks to prove it was actually of use.

Use PadWalker to access %cache outside the sub. (I'm guessing it should work on 5.10's state variables, but don't know it for a fact.)