Added caching support

No cache mode is still buggy and needs to be tested