finished basic implementation of cache