Page 1 of 1

Clear the disk cache

Posted: Thu Nov 01, 2007 6:37 am
by BigJonMX
Firstoff: SwiftMailer Rocks - it is bees-knees :D

I just implemented
Swift_CacheFactory::setClassName("Swift_Cache_Disk");
Swift_Cache_Disk::setSavePath($mytempfolder);
And its all going just swell.

But i see that my temp folder is filling up with files, and never emptying
so i guess i need to do it manually
But how? (sorry if its said already. i did search.)

i see there is a clear() command and i'm hoping i can stick it in above my ultimate line of code
$swift->clear(); // clear disk cache when finished
$swift->disconnect();

Thanks

Posted: Thu Nov 01, 2007 7:53 am
by Chris Corbyn
Thanks :D

This should never happen, something is going wrong in the Disk cache. What version of Swift are you using, and what version of PHP?

The temp folder should empty during script shutdown, so if the script is a continuous while loop the directory will fill up (at least in PHP4). In PHP5 the destructor is used, although I think the GC only runs at shutdown anyway since it can't run asynchronously.

more info

Posted: Fri Nov 02, 2007 7:10 am
by BigJonMX
php: v522
mysql: v5045
swift mailer: v332php5
test box: windows server 2003

To give you an idea of my page...

REPORTS.PHP
if $_POST get reports
__if ButtonEmailReports: new swift, disk-caching, set $from, etc
show pagemenu with options
Loop
__show reports if any
____if ButtonEmailReports: ->attach, ->send, ->showresult
EndLoop
if ButtonEmailReports: ->disconnect

i have yet to explore the plugins and more advanced features
but from what i've done so far, everything works well.
My tempfolder fills up with files like 0ad0b8cd8138c31e85fdc918ff32a6fb-body,-bdl_le,-headers
(i put the hyphen in for clarity)

The problem is i still have 182files in the temp folder from my testing a few days ago.

Thanks for your help, Jonny