I'm working on a website for a music / artist agency. On the homepage we need al the artist entries. More than 200.
Each artist profile has an image, an image color extruder picker, some tags, relation, etc etc.
Without caching I have a lot of queries. But the page can render. If I enable cache, the server runs out of memory sometimes. And when I enable an entry, or edit an entry, the whole cache with the artist loop gets cleared.
This is my code.
{% block content %}
{% cache for 1 week %}
{% set cases = craft.entries({
section: 'artist',
order: 'title',
limit: null
}) %}
{% for entry in cases %}
<article class="artist filter-{{ entry.title|first|lower }}">
{% set tags = entry.genre %}
{% set agent = entry.agent %}
{% set image = entry.introFoto.first() %}
...
...
etc etc
</article>
{% endfor %}
{% endcache %}
{% endblock %}
So can I cache individual entries? Like so? When someone edits an entry, only that entry cache get cleared?
{% block content %}
{% set cases = craft.entries({
section: 'artist',
order: 'title',
limit: null
}) %}
{% for entry in cases %}
{% cache for 1 week %}
<article class="artist filter-{{ entry.title|first|lower}}">
{% set tags = entry.genre %}
{% set agent = entry.agent %}
{% set image = entry.introFoto.first() %}
...
...
etc etc
</article>
{% endcache %}
{% endfor %}
{% endblock %}