Cachematrix inplementation and example usage