Yasser1984
Yasser1984

Reputation: 2451

Where is the best place to store your Smarty template cache files?

I'm considering either

/tmp

or

/var/cache

or

some folder in your code

I like /temp more, because if it grows too much, the system will usually take care of it, and it's universally writeable so probably more portable code.

But at the other hand I will have to store files in a folder within any of these, so making a folder and checking if it exists has to be done on /tmp, not on /var/cache, since /var/cache is not likely to get removed by linux or any other sort of common software.

What do you think? What is the best practice?

Upvotes: 2

Views: 232

Answers (1)

clops
clops

Reputation: 5245

There are many approaches to storing smarty cache and, apparently, no best-case scenario i.e. the matter being more a matter of preference.

I can only say that I have witnessed hundreds of projects where Smarty cache was stored in the project's relative folders (for example /projects/cache/compiled/) for a number of reasons:

  • Full control of the application's cache
  • Ability to share the same cache amongst several servers
  • No need to re-create the cache after the system has tidied the /tmp folder

Moreover, we see compiled templates residing inside memcache more and more each day.

Upvotes: 1

Related Questions