added cachedir param for cache method.