Simple two-level cache written in Java