Cakephp tmp directory: Cache and Session Folders
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
BIOS
Updated on June 04, 2022Comments
-
BIOS almost 2 years
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.
-
summea about 11 yearsCached copies of parts of your app.
-
BIOS about 11 yearsReally? 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.
-
summea about 11 yearsWhat are you trying to do with this information?
-
BIOS about 11 yearsBetter understand the framework? :?
-
summea about 11 yearsYou may want to look into "serialization" in that case.
-
BIOS about 11 yearsThat's a start. Thanks :)
-
-
BIOS about 11 yearsI'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? :?
-
thaJeztah about 11 yearsInside
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
andcache
. By default, this is set tophp
, which will store the sessions in the location set in php.ini (e.g./tmp/
) -
BIOS about 11 yearsExcellent. Thanks for clarifying!
-
thaJeztah about 11 yearsGood luck with your project!
-
Hardik Gajjar almost 7 yearscan i delete all files and folder under tmp ?
-
thaJeztah almost 7 yearsTo 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.
-
Gegenwind about 5 yearsOld 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.