Menu

#1741 Cache Settings

Parent Category:
DPCalendar
Category:
System tasks
Last Updated:
Allon Moritz, Wednesday, 19 June 2024 12:13
Created:
Wednesday, 26 November 2014 21:16
Hits:
10929

Introduction

A cache is a method of storing previously retrieved information for a certain amount of time temporarily. For DPCalendar, when the first user requests a Joomla page with a DPCalendar (or plugin) on it, the data is retrieved from the database or calendar source. This takes time. Time to retrieve and process the information. When a second user requests the same page and the cache is enabled, the information is pulled from the cache (memory) instead of the original source. This is faster and uses less server resources. However, the information will be minutes old. For most users the delay is not noticed. If you are responsible to update the calendar, you might not see the update for several minutes after you made the change. Turning off the cache will show changes more quickly but can slow your site down considerably.

Joomla has a caching system as does DPCalendar and other extensions, they will be explained more deeply in the next chapters.

Joomla Cache

The best cache option for your site is the cache plugin, which caches the whole page. Means that no PHP code is executed at all, will relax your server and deliver the pages faster. You may find Joomla's cache settings in the Global Configuration > System tab. More Information can be found in this article from the official Joomla docs.

DPCalendar external events plugin cache

Every plugin which integrates external events into DPCalendar has options to choose a cache behavior to temporary save the external events on the Joomla site and to increase/decrease the cache time. You can even turn off the cache completely in the plugin settings.

Joomla cache

The Joomla cache option caches the events in a file in the cache folder within your Joomla installation. The time settings defines the lifespan of the cached files before the events are refetched from the remote system. This behavior is used since the beginning of DPCalendar and is the most stable option.

Database cache

The Database cache duplicates the events in the database dpcalendar_events table from your remote system. This brings the benefits that only the local database is touched during an event request and no connection is established to an external server. The site administrator should use this option together with the Task plugin, as it is able to perform the task sync within the scheduler context.

It is very much recommended to run the scheduler as a cron job when database caching is enabled, which syncs the events completely in the background. Like that the visitor will never suffer from events sync during a page load.

The following line can be copied into the crontab file to set up a scheduler cron job. Keep in mind that you need to properly set the task execution time. For example if your cache time is 15 minutes, then you should run the task every 14 minutes, like that is the sync always done before the cache has expired.

* * * * * /{my-path-php-executable}/php /{{joomla-root}}/cli/joomla.php scheduler:run

The database cache works the way that it fetches per default the last three years and the next three years of events. One year at a time and adds the events into the database. These settings can be controlled in the plugin parameters when database caching is enabled. If you have a lot of events, then it is recommended to lower the sync step value. It is done that way as incremental sync is not supported by every plugin and the initial sync will explode your database on large calendars.

Location Cache

When a location for a string is requested, during external event sync, then the location is stored in the database and is available for edit in the DPCalendar back end's Location Manager. If something is wrong with a location it can easily be corrected. If you want to refetch the locations, just delete them and on the next external event sync, they will be recreated.

Comments (0)

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.