added the ability to limit cache size