protected function file_path_for_key($key, $create = false) {
        if ($this->singledirectory) {
            // Its a single directory, easy, just the store instances path + the file name.
            return $this->path . '/' . $key . '.cache';
        } else {
            // We are using a single subdirectory to achieve 1 level.
           // We suffix the subdir so it does not clash with any windows
           // reserved filenames like 'con'.
            $subdir = substr($key, 0, 3) . '-cache';
            $dir = $this->path . '/' . $subdir;
            if ($create) {
                // Create the directory. This function does it recursivily!
                make_writable_directory($dir, false);
            }
            return $dir . '/' . $key . '.cache';
        }
    }