Clear the disk cache

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
BigJonMX
Forum Newbie
Posts: 15
Joined: Sun Nov 20, 2005 11:28 am
Location: CardboardBox, WindyCity

Clear the disk cache

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
BigJonMX
Forum Newbie
Posts: 15
Joined: Sun Nov 20, 2005 11:28 am
Location: CardboardBox, WindyCity

more info

Post 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
Post Reply