This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

swt83
swt83

I'm trying to determine what I need to cache myself to prevent unnecessary database calls.

I can see that settings are stored in the database, but searching my project for keywords I can find that my settings are also being stored as a cache. So that would mean I don't need to cache those myself.

I can't find component properties in the database at all, but I do find them stored as a cache. So that would mean I don't need to cache those myself either.

I just want to confirm that, as a best practice, I do NOT have to cache settings or component properties, but I DO need to cache model (Eloquent) database results.

Last updated

alxy
alxy

Component properties are not saved in the database, but in the Configuration section of the file where they are used.

Setting values (Models that implement the SettingsBehavior) are cached.

swt83
swt83

alxy said:

Component properties are not saved in the database, but in the Configuration section of the file where they are used.

Setting values (Models that implement the SettingsBehavior) are cached.

So my closing statement is correct, yes, that I do not need to worry about caching these and that I only need to concern myself with Eloquent responses.

alxy
alxy

Well, caching is usefull whenever you need to run a time consuming operation (that may be a database query, an API call, or a complex calculation (result).) If you worry about database queries, I encourage you to install the Debugbar plugin, as this will reveal any query ran on the current request.

Last updated

swt83
swt83

alxy said:

Well, caching is usefull whenever you need to run a time consuming operation (that may be a database query, an API call, or a complex calculation (result).) If you worry about database queries, I encourage you to install the Debugbar plugin, as this will reveal any query ran on the current request.

The concern is that every page that includes a component w/ settings, do I need to cache those properties or those settings so it doesn't ask the database every pageload. My understanding from your answer is that I do not, it's automated.

alxy
alxy

This is correct. But still you should install the plugin, as it really shows all the queries (even internal ones (made by core)).

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.