Radically increasing efficiency by caching function outputs.

Addresses https://github.com/coverall/Attendease/issues/4018