Cache class

The following sections explain each method of the class.


public static boolean set_cache_dir ( String $cachePath)

With the set_cache_dir you make method the location of cache files fixed.

Parameter list

The path should be an absolute to the destination folder and to avoid complications in understanding. If the folder does not exist it will be created. The path should be empty, or the specified path does not refer to a folder, a false back given


public static boolean set_cache_active ( Boolean $active = false)

Sets the cache on active. If the cache is inactive, any data in the cache will be saved or read.

Parameter list

Sets the cache on active true or inactivefalse


public static boolean set_cache_extension ( String $extension = 'cache')

Each cache file is the file extension. cache. If you would like to change this, you can enter an alternative file name extension.

Parameter list

The alternative file extension for cache files. By default ". cache"


public static boolean set_template_element ( String $cache_name, String $content)

The method set_template_element saves all the HTML files in the cache directory. So Web pages can be built faster. PHP and MySQL is already parsed.

Caution: This file extension is used .html and not the registered file extension of the methodset_cache_extension

Parameter list

The parameter cache_name is the unique name of the cache file. This is to the store used on the Web server. This special characters should be avoided.


The parameter content is the content of the cache file. You should only use this method if you want to save all the HTML sections.


public static boolean|string get_template_element ( String $cache_name, Integer $lifetime = 500)

Returns a template cache file, if the life of not specifying the parameter lifetime exceed. Otherwise, the method returns false back.

Parameter list

The name of the cache to retrieve file. If the method of no cache file under this name, which is false back.


The parameter lifetime is designed to return only cache content corresponding to a certain age. By default, the value to 500 seconds is set.


public static boolean set_element ( String $cache_name, String $content, Integer $lifetime = 500)

Stores content in a cache file. This cache file exists only for the specified period. The period has expired, the cache file is deleted from the Web server. If successful, this method returns a true back, otherwise an false .

Parameter list

The name of the cache to be memorized file. File with this name exists already a cache, it will be overwritten.


The contents of the cache file. All common types of PHP are supported here.


The maximum lifetime in seconds the cache file.


public static boolean|mixed get_element ( String $cache_name)

Returns file the content to cache, as long as the maximum lifespan is not exceeded. Otherwise a false back given

Parameter list

The name of the cache to retrieve file. The cache should not exist file, is a false back given.


public static boolean delete_element ( String $cache_name)

A cache file in the cache permanently deletes directory and returns a success true , in case of an error a false back.

Parameter list

The file name of the cache to delete file. Should the file not exists, is a false back given.