Edjet LMS Server

Caching

Also whole caching subsystem is implemented for two reasons – speed and server load (both processing and bandwidth load). There are several types of caching involved in server-client interactions:

=== TABULKA ===

Images cache

This type of cache is implemented everywhere the image is processed via imageGenerator class.

ImageGenerator class
This class is placed in <approot>\class\class_imagegenerator.php

Class is using this methods:

  • loadSrc – used for loading the url of cached image (string)
  • getSrc - used for loading the url of cached image (output echo)

getSrc

This class is used for caching images. When image from Media-library is used in page (anywhere in system, both admin and site – depending on used template) then following procedure is applied:

  • first hash of original image is acquired
  • then required image dimensions are acquired (input for method, defined in template typically)
  • then other parameters are acquired (if any) like „square“, „crop“, „watermark“ etc.
  • in other step this data are compared to existing files in image cache directory
  • if file is matched, then this cached image path is returned into method
  • if file is not matched, then appropriate cached image is built via GD library and cached image path is returned into method

Image cache directory / path
Both values are defined in config.php.
Default value is: tmp\cache\images

Cached file name format options
This format is defined in cfg.ini.php in section System in variable image_cache_format.

Format can consists from following parts:

  • info: required paramerers (dimensions + other options...)
  • hash: filehash (sha1) of image (used for image ID and security issues – protecting files)
  • ext: extension of image (jpg, gif, png)
  • filename: name of image (returned value is with extension)

Default format is info_hash.ext
Example of file name of cached image
150_150__4f3b0172bb9866239cbf9ba1a3d5c23543a01518.jpg

Example of syntax of using imagegenerator in templates:
ImageGenerator::loadSrc(security::image_getFullPath($value['image_path'] . $value['image_filename']), 180, 220, true, true, true);

For more examples see code_examples.tpl.php.

Localization strings cache

This type of cache is implemented everywhere the localization string is processed via Lang class.
Cache folder is located in system files repository: /tmp/cache/localization_strings/

Enable gzip compression support

Turn on zlib.output_compression for example on your server.

Also the compression should be set for various possible mimetypes:

  • HTML
  • CSS
  • JS
  • other cacheable mimetypes
Related