Knowledge Base - Advanced Features Guide
The cache in the Google maps for Geocode Factory
How it work
- Ensure you that you have at least the version 2.1.2 of Geocode Factory
- Edit the map where you want to enable the cache
- Go on the "Display options" tab
- Check the "Cache duration:" option to the desired cache duration
The cache creates a temporary file that contains all of the makers and connections paths. It reduce the loading time and reduces the time between the frontend markerset changing. If you dont use the cache, the markers list is generated each time the map is loaded, that that can use some server resources. If the cache is activated, and a user do a radius search, Geocode Factory do a dynamic search without using the cache, but if you reset or reload the map the cache file is re-used. The cache file and generation of marker lists is all done on the user's computer (client side). Cache process:
- you set the cache to 15 minutes
- you open the map page at 12h00
- the cache file is created
- you reload the map at 12h05
- the map opens quickly (without writing any files or loading profiles from database)
- if a user subscribes on your site at 12h10 and loads to a map at 12h11
- the user won't appears on the map because the cache file is generated before at 12h00
- if the user reloads the map at 12h16
- the cache file is recreated from the db and the new user is included in
- the map open with the same markers for the next 15 minutes
In all cases the contents of the bubble is loaded dynamically using AJAX so the contents of the bubbles is not affected by the cache settings.
Note 1 : If you use a very static map (for example a list of your office that never change) you can set a very long time cache. But if you use a communty site then a short time can be used. Of course if you think that the no cache option loading time is acceptable, then you don't have to use it at all.
Note 2 : The cache file is located in the joomla_root/cache/ folder (this folder must be writable by joomla). The file is named _geocode_factory_ID_ITEMID.xml, where ID is the id of the map and ITEMID is the itemid of the menu. If you delete the file, it will be regenerated.
Note 3 : Of course, in a perfect world the cache file is regenerated only when a new user creates a profile or if a profile is modified, but we cannot in a practical way modify the core files of the other components.
What about the Joomla! cache
Geocode Factory is not affected by Joomla! internal cache system because, to be cached, the component need to use Joomla cache methods. We dont use them.
If you use different cache components or if your template use cache functionnalities, it will be a good solution to disable them when displaying Geocode Factory. Why? Because the markers generation, is different each time, depends the user's position, and some time the marker loading is randomised.
For all theses reasons, we use our own cache system, that load the same markers for the same map during 5min, 1 hours, 1 day... time to choice. This is above.
Geocode Factory 3, Geocode Factory 5