According to Wikipedia, caching is a method of storing a collection of data for which the time it takes to compute said data is longer than the time it takes to retrieve from the cache. Also, the concept of caching was invented by Mr. T. I suspect that last part may have been added by Wikipedia vandals, though...

One of Eli A.'s predecessors took Mr. T.'s concept and ran with it. He cached everything he could get his hands on — configuration values, event dates, phone numbers, everything. Why tax the hardware with an expensive lookup when everything's right at your fingertips in a giant, hideous blob of a cache?

Eli's predecessor's tenure didn't last terribly long; he left (or was fired, maybe) after a couple of months of adding caching to virtually every aspect of the application. One of his last changes was adding a singleton to store the current year:

public class CommonVars {
    private final static CommonVars instance = new CommonVars();
    public static CommonVars getInstance() {
        return instance;
    private CommonVars() {
        currentYear = Calendar.getInstance().get(Calendar.YEAR);

    public int getCurrentYear() {
        return currentYear;

With this, Eli's predecessor was able to avoid the taxing the system with a date lookup. He missed out on some of the fun that this change caused later, though, since he hadn't stayed long enough for the year to roll over.

Every January 1, a user would report some weird problems in the system recording dates in the wrong year. The complaints came from a different user each year, because for some reason users never stuck around for more than a few months. And every year, the poor guy would take several hours tracking down someone in IT to explain the problem and have them reboot the server, then the value would be re-initialized whenever the fist new user session started.

Oh well, just 244 days until the next reboot...

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!