Moved cache directory check to cache class, set folder permissions