Cache in app development

Hi. I’m facing cache problem when developing an app. When I run that app on Chrome, the UI, or compiled JS code, is not updated. So that, I need to clear the cache or open in incognito mode. But the PHP code is also cached. When I change my code in a controller, it does not affect the running app. I need to close and open another incognito window.
How can I fix this problem? Sometimes I need to update some apps and I want to make sure that every users get the latest updates.

Hello, there are multiple levels of catching generally possible. However, it is hard to guess you problem right now especially when you have multiple of them.

What is your setup of development? Are you using the docker setup from Julius Härtel? In fact,I would first try to fix the backend to role that out. Theoretically, there should be no catches in PHP involved during development. Is OpCache enabled? Is there a facing proxy between browser and server? Or is the browser doing the caching?

For frontend development, I assume you are using hot module reload? Then, all caches are bypassed.

I have never seen problems with caching during development to be honest. So, you might want to share a bit more of your setup of app :wink: .


I just pull image Nextcloud 27 from Docker Hub. There’s no proxy.

What is OpCache? I haven’t heard it before. ;-;

Long sorry short: PHP: OPcache - Manual
It is a jit complete for PHP to speed up execution. If the PHP binary for some reason does not detect the changes in the PHP files, there could be stale cache entries used. But I highly doubt that. However, it could be one point of problems, though.

I would highly encourage to use a real development environment. This is for multiple reasons:

  1. You can be sure that this setup work with other users as well
  2. Any new features of the environment you can use. As I wrote, have a look at GitHub - juliushaertl/nextcloud-docker-dev: Nextcloud development environment using docker-compose. It is built just for development with all stuff in mind.
  3. Production code might have caches at various levels that makes development harder than needed. Go for a development environment.
  4. A common environment simplifies inter-app support from other maintainers.

I had my custom environment as well and switched to the environment of Julius and I am happy with it.