R
R
ragnar_ok2021-07-22 17:31:11
1C-Bitrix
ragnar_ok, 2021-07-22 17:31:11

How best to use caching when filtering by date?

Elements of the "Events" infoblock with the "Event start date (character code DATE_START)" property are given. You need to get separately upcoming events (from the current date) and separately past events (before the current date). When setting the filter by the current date (see example below), there will be a separate cache file for each day.

$GLOBALS[$arParams['FILTER_NAME']]['>PROPERTY_DATE_START'] = date('Y-m-d');

$APPLICATION->IncludeComponent('bitrix:news.list', '.default', ['CACHE_FILTER' => 'Y']);

How best to use caching?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-07-22
@ragnar_ok

So use it, only make the cache lifetime 1 day, after that it will be deleted

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question