# Problem with cache

**URL:** <https://discourse.cakephp.org/t/problem-with-cache/7323>\
**Category:** Need Help\
**Created:** [February 21, 2020, 7:32am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323 "2020-02-21T07:32:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasg](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@thomasg](https://discourse.cakephp.org/u/thomasg)\
**Post date:** [February 21, 2020, 7:32am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/1 "2020-02-21T07:32:20Z")

</div>

Since I update to cakephp 3.7 and 3.8 I am having problems with the cache not getting refreshed. Have there been some updates about settings for cache that I am not aware of. That cause everything to not work properly?

---

<div class="post-metadata">

**Author:** ![thomasg](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@thomasg](https://discourse.cakephp.org/u/thomasg)\
**Post date:** [February 21, 2020, 7:39am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/2 "2020-02-21T07:39:25Z")

</div>

Including debugkit is also not working when I switch to debug true, I always need to delete cache manually for it to show up properly. Then turn it to false, and back to true, it is in the right corner again a small box, with an error missing controller. Every time I need to manually delete cache. This only start after update from 3.6 to 3.7. I saw in the manual that somethings have changed about the cache system, This probably causing all the problems now…

---

<div class="post-metadata">

**Author:** ![kasgdkjasgdklhjsagdk](https://avatars.discourse-cdn.com/v4/letter/k/f14d63/32.png) [@kasgdkjasgdklhjsagdk](https://discourse.cakephp.org/u/kasgdkjasgdklhjsagdk)\
**Post date:** [February 27, 2020, 8:50am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/3 "2020-02-27T08:50:54Z")

</div>

I’m also having cache issues, but on 4.0. I was previously on 3.6 with no issues. My pages will spontaneously and intermittently fail to load with the error

```
Cake\Routing\RouteCollection::parseRequest(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;Cake\Routing\Route\DynamicPageRoute&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition

File $PATH_TO_APP/vendor/cakephp/cakephp/src/Routing/RouteCollection.php

Line 199 

```

Or with

```
The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;Cake\Routing\Route\DynamicPageRoute&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition

File $PATH_TO_APP/vendor/cakephp/cakephp/src/Error/Debugger.php

Line 606

```

I’ve spent around ten hours screwing with this, hitting new errors over and over, discovering the documentation is incorrect and the api guide linked from the home page doesn’t even exist, and finally getting bitten by the totally unpredictable cache issue, and come to the conclusion that I shouldn’t have upgraded.

---

<div class="post-metadata">

**Author:** ![thomasg](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@thomasg](https://discourse.cakephp.org/u/thomasg)\
**Post date:** [February 27, 2020, 9:04am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/4 "2020-02-27T09:04:38Z")

</div>

The forum is pretty much dead anyway

---

<div class="post-metadata">

**Author:** ![Schlaefer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/schlaefer/32/1001_2.png) [@Schlaefer](https://discourse.cakephp.org/u/Schlaefer)\
**Post date:** [February 27, 2020, 10:25am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/5 "2020-02-27T10:25:03Z")

</div>

Do you have a class

```auto
Cake\Routing\Route\DynamicPageRoute

```

somewhere? Can’t find any reference to it in CakePHP.

---

<div class="post-metadata">

**Author:** ![kasgdkjasgdklhjsagdk](https://avatars.discourse-cdn.com/v4/letter/k/f14d63/32.png) [@kasgdkjasgdklhjsagdk](https://discourse.cakephp.org/u/kasgdkjasgdklhjsagdk)\
**Post date:** [February 27, 2020, 11:04pm UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/6 "2020-02-27T23:04:51Z")

</div>

Yes, that’s my custom route.

I can “fix” the issue for now by throwing a `Cache::disable()` at the bottom of `bootstrap.php`, or by disabling my custom route. Neither of these is a real solution, so I’m back to scouring the net for resources and trying to figure out what’s going on.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [February 28, 2020, 4:39am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/7 "2020-02-28T04:39:22Z")

</div>

_You_ have a class in the `Cake` namespace? That shouldn’t ever happen. Your code should all be in your own namespace (`App`, by default).

---

<div class="post-metadata">

**Author:** ![Schlaefer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/schlaefer/32/1001_2.png) [@Schlaefer](https://discourse.cakephp.org/u/Schlaefer)\
**Post date:** [February 28, 2020, 8:16am UTC](https://discourse.cakephp.org/t/problem-with-cache/7323/8 "2020-02-28T08:16:33Z")

</div>

> [@kasgdkjasgdklhjsagdk](#):
>
> Neither of these is a real solution, so I’m back to scouring the net for resources and trying to figure out what’s going on.

Well you could post code here for people to look at. But best guess so far is a messed up class namespaces/loading setup within your code. There probably isn’t a cache issue, it just happens to be the cache that trips over it.
