matrix caching solution