4

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.

BIOS
  • 1,655
  • 5
  • 20
  • 36
  • Cached copies of parts of your app. – summea Mar 20 '13 at 19:44
  • Really? As indicated in my question I am looking for specificity here. This is no way answers my question (there is a question about session folder there too). Additionally I can infer that the cache folder works as a cache. I want to know what its caching exactly (breaking down each folder) and how is the data stored (format) etc. – BIOS Mar 20 '13 at 19:50
  • What are you trying to do with this information? – summea Mar 20 '13 at 19:51
  • Better understand the framework? :? – BIOS Mar 20 '13 at 19:56
  • 1
    You may want to look into ["serialization"](http://php.net/manual/en/function.serialize.php) in that case. – summea Mar 20 '13 at 19:58
  • 1
    That's a start. Thanks :) – BIOS Mar 20 '13 at 20:00

1 Answers1

10

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

Community
  • 1
  • 1
thaJeztah
  • 27,738
  • 9
  • 73
  • 92
  • I'm using the 'Session' as a component. Is that what you mean by using cake as the session handler? If so, why would 'session' directory be empty with an active session? :? – BIOS Mar 20 '13 at 23:42
  • Inside `app/Config/core.php` there's a section 'Session configuration'. Inside this there's an explanation for various storage-methods (session-handlers) for the session; `php`, `cake`, `database` and `cache`. By default, this is set to `php`, which will store the sessions in the location set in php.ini (e.g. `/tmp/`) – thaJeztah Mar 21 '13 at 10:22
  • Good luck with your project! – thaJeztah Mar 21 '13 at 11:49
  • can i delete all files and folder under tmp ? – Hardik Gajjar May 16 '17 at 07:23
  • To be safe, you can remove the _files_, but keep the directories (at least the top-level ones. If I remember correctly, not all directories are created automatically, so removing them can result in errors. – thaJeztah May 16 '17 at 10:55
  • Old but gold: CakePHP (2.x) creates the cache folders only automatically if in debug mode. This can be especially probelmatic if a cache is not initialized at app startup so you might miss a folder without recognizing. To be save: Create the folders right away and dont delete them. – Gegenwind Apr 24 '19 at 13:11