Home > OS >  Suspected Caching Issue with CakePhp 4
Suspected Caching Issue with CakePhp 4

Time:11-14

I'm recently getting back into programming after taking a break for quite some time. I'm currently trying to rebuild my CakePhp 2.X apps for CakePhp 4.X. I'm developing in a local environment using Bitnami WAMP stack.

The issue is that development is very slow because changes do not seem to be taking effect immediately. I have tried disabling all caching by using

Cache::disable();

I've tried placing this line in various places

 config/boostrap.php
 config/app.php
 config/app_local.php
 src/application.php

How this is impacting me: I'll make an update, for instance, to a model table file or controller file. I'll go refresh my site to preview the change and either there is no update or there might be an error. To fix the error, I try to undo the changes I made. I go back to my browser and hard refresh the page. I continue to see the same error for 10 minutes. This often leads me to wanting to undo previous steps but I know that those previous steps didn't cause the issue and it was only the most recent change that caused it. It's making it difficult to keep track of what changes are causing issues and what solutions are working. Even something as simple as updating my navigation element (templates/elements/nav.php) to add a new link does not show on the page when I refresh. I've also tried clearing my browser cache (I use Chrome).

CodePudding user response:

Did you try to clear all keys? You can do it with:

// Will clear all keys.
Cache::clear();

Cache::disable() should work also.

You can also delete the contents of /tmp/cache/ if the caching is set on File.


Maybe the problem is Bitnami WAMP itself. Try to disable the server cache:

https://docs.bitnami.com/installer/infrastructure/wamp/administration/disable-cache/

If you are developing on top of an AMP Stack or customizing any Bitnami Stack, your files (like JavaScript files) may be cached by the server and even you modify them your changes will not appear to be applied.

In order to disable the cache in the server and let the files be served each time, disable PageSpeed for Apache and OPCache for PHP, enabled by default

  • Related