added unit test for layer caching