restructe the cache method.
example code