What is a Cache?
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. This may upset some users that want to see their changes immediately. 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.
Cache |
Off - Caching Disabled On - Conservative Caching On - Progressive Caching
|
No caching Some caching Most caching
|
Cache Handler |
File Alternative PHP Caching |
Data saved as a file on your server Data saved as per your PHP settings |
Cache Time |
15 (minutes or 900 seconds) |
Longer times = faster site and less up to date |
For more information see this article from Joomla - http://docs.joomla.org/Cache
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
In DPCalendar 5.2 the Database cache option was introduced to have the the full power of database operations on external events. This options is properly tested but has still issues when not used together with a cron job as it fetches all the events for a timespan and updates the database. It's the option to use when you are an experienced server administrator as you need to set up a cron job and adjust probably some PHP settings in an ini file. The following list shows the most important ones:
- memory_limit
Set it to a high value like 128M. If you still get memory errors, increase it till they stop.
- max_execution_time
Set it to 0 to disable max execution time on CLI tasks.
It is very much recommended to set up 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. DPCalendar comes with a script which can be run on the command line and as cron job. It can be found in the folder /administrator/components/com_dpcalendar/cli and has the name eventsync.php.
The following line can be copied into the crontab file to set up a cron job. Keep in mind that you need to properly set the cron execution time. For example if your cache time is 15 minutes, then you should run the cron job every 14 minutes like that the sync is always done on the command line.
*/14 * * * * /{my-path-php-executable}/php /{{joomla-root}}/administrator/components/com_dpcalendar/cli/eventsync.php
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.
Plugin cache comparison
The following list shows which plugin does support which cache option.
Plugin |
Joomla Cache |
Database Cache |
DPCalendar - Ical |
|
|
DPCalendar - Google |
|
|
DPCalendar - JCalPro |
|
|
DPCalendar - JEvents |
|
|
DPCalendar - RSevents Pro |
|
|
DPCalendar - Twitter |
|
|
DPCalendar - Jomsocial |
|
|
DPCalendar - Facebook |
|
|
DPCalendar - CSV |
|
|
DPCalendar - CalDAV |
|
|
DPCalendar - Meetup |
|
|
DPCalendar - Twitter |
|
|
DPCalendar - Exchange |
|
|
DPCalendar - SQL |
|
|
System - DPCalendar |
|
|
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.