Cakephp tmp directory: Cache and Session Folders

BIOS picture BIOS · Mar 20, 2013 · Viewed 14.8k times · Source

Can someone please explain to me what kind of data is stored in these directories?

For example, I have an active session (with auth) now but the sessions directory is empty?

What exactly is stored in the folders (models, persistent, views) within the cache folder?

Ex in the persistent folder I have a file called 'myapp_cake_core_cake_dev_en-us' and if I open that I can see:

1363808159
a:1:{s:11:"LC_MESSAGES";a:0:{}}

Please be as specific as possible.

Answer

thaJeztah picture thaJeztah · Mar 20, 2013

I'll try to describe their content (out of my head, so I may have missed some)

app/tmp/logs/

Contains various log files generated by CakePHP

app/tmp/sessions/

Contains the sessions of your website if 'Cake' is used as your session-handler if the php or database session-handlers are used, this directory will be empty. The session-handler can be configured in your app/Config/core.php configuration

app/tmp/cache/models

Will contain the model-cache; CakePHP will cache schema-definitions of your database tables, so that it's not needed to fetch that information from the database with each use.

app/tmp/cache/persistent

Will contain cache information about the location of classes/objects and parsed 'locale' files. This information will prevent CakePHP from having to scan all directories to find/load Controllers, Helpers etc.

The tmp/Cache directories may contain other files, for example if you're using 'view' caching, or other (custom) caching, this is the most probable location to store those cached information.

cache engines

The cache directories will only be used for the File cache mechanism. It's also possible to use other cache mechanisms, for example Apc or Memcached. These cache mechanism will keep the cached information inside the memory (RAM) of your server, which is a lot faster.

Read about cache engines in CakePHP here:

http://book.cakephp.org/2.0/en/core-libraries/caching.html