implementing disk cache
Posted: Fri Apr 03, 2009 7:16 am
In v3 I used to set the cache to disk with
In v4 in the preferences I found this
but I don't understand how to give it a path to a writable dir. I can't seem to find the sys_get_temp_dir() function. Looking at the Swift_Preferences class it would seem all I have to do is put a path string in setTempDir(). Is that right or should I change the value in the dependency_maps for the cache? Also, how do I know that it is using the cache and not writing to an array? Can I assume with the disk cache that adding 3 or 4 megs of attachments while using the decorator plugin shouldn't be a problem?
Code: Select all
Swift_CacheFactory::setClassName("Swift_Cache_Disk");
Swift_Cache_Disk::setSavePath("../includes/swiftmailer/tmp");Code: Select all
if (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()))
{
Swift_Preferences::getInstance()
-> setTempDir(sys_get_temp_dir())
-> setCacheType('disk');
}