|
1 | 1 |  |
2 | 2 |
|
3 | 3 | # Model Caching for Laravel |
| 4 | +[](https://gitter.im/GeneaLabs/laravel-model-caching?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) |
4 | 5 | [](https://travis-ci.org/GeneaLabs/laravel-model-caching) |
5 | 6 | [](https://insight.sensiolabs.com/projects/fde269ac-c382-4d17-a647-c69ad6b9dd85) |
6 | 7 | [](https://scrutinizer-ci.com/g/GeneaLabs/laravel-model-caching) |
@@ -65,9 +66,15 @@ abstract class BaseModel extends CachedModel |
65 | 66 | } |
66 | 67 | ``` |
67 | 68 |
|
| 69 | +### Exception: User Model |
| 70 | +I would not recommend caching the user model, as it is a special case, since it |
| 71 | +extends `Illuminate\Foundation\Auth\User`. Overriding that would break functionality. |
| 72 | +Not only that, but it probably isn't a good idea to cache the user model anyway, |
| 73 | +since you always want to pull the most up-to-date info on it. |
| 74 | + |
68 | 75 | ### Optional Disabling Caching of Queries |
69 | 76 | **Recommendation: add this to all your seeder queries to avoid pulling in |
70 | | -cacched information when reseeding multiple times.** |
| 77 | +cached information when reseeding multiple times.** |
71 | 78 | You can disable a given query by using `disableCache()` in the query chain, and |
72 | 79 | it needs to be placed (anywhere) prior to the query command (`get()`, `all()`, |
73 | 80 | `find()`, etc). For example: |
|
0 commit comments