I’m going to make my app spool mail, and am trying to find a good place to put the mail spool file.
I like %kernel.cache.dir%/foobarmailspool because it means my (and my fellow developers’) existing filesystem ACLs won’t need augmentation.
Is writing in app/cache poor form?
If not, is there some naming convention I could/should follow?
On second thought, it’s probably not a great idea to spool emails into app/cache, given all the blowing away of the cache that must occur while using symfony2. Still, my question needn’t be specific to spooling email, but more about writing to the cache in general (as stated in the title).
Storing them within the cache folder might seem like a good ideea since you already have writing rights there, but all cache locations should be treated as “volatile” and thus unreliable.
If you are just writing them to disk for testing, you can always use /tmp/ or if you are using them in the same execution thread, there is always the well handy I/O streams option within php, more on that at http://php.net/manual/en/wrappers.php.php.
If you want to do it in a production environment however, you would need a real folder on disc with the right permission sets, database, or even memcache if you plan expires well.