PHP Class Elgg\Cache\SimpleCache

Since: 1.10.0
Datei anzeigen Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( Config $config, ViewsService $views ) Constructor
disable ( ) : void Disables the simple cache.
enable ( ) : void Enables the simple cache.
getRoot ( ) : string Get the base url for simple cache requests
getUrl ( string $view, string $subview = '' ) : string Get the URL for the cached view.
init ( ) : void Set up config appropriately on engine boot.
invalidate ( ) : boolean Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every valid viewtype.
isEnabled ( ) : boolean Is simple cache enabled
registerView ( string $view_name ) : void Registers a view to simple cache.

Private Methods

Method Description
getPath ( ) : string Returns the path to where views are simplecached.

Method Details

__construct() public method

Constructor
public __construct ( Config $config, ViewsService $views )
$config Elgg\Config Elgg's global configuration
$views Elgg\ViewsService Elgg's views registry

disable() public method

Disables the simple cache.
See also: elgg_register_simplecache_view()
public disable ( ) : void
return void

enable() public method

Enables the simple cache.
See also: elgg_register_simplecache_view()
public enable ( ) : void
return void

getRoot() public method

Get the base url for simple cache requests
public getRoot ( ) : string
return string The simplecache root url for the current viewtype.

getUrl() public method

Recommended usage is to just pass the entire view name as the first and only arg: $blog_js = $simpleCache->getUrl('blog/save_draft.js'); $favicon = $simpleCache->getUrl('graphics/favicon.ico'); For backwards compatibility with older versions of Elgg, you can also pass "js" or "css" as the first arg, with the rest of the view name as the second arg: $blog_js = $simpleCache->getUrl('js', 'blog/save_draft.js'); This automatically registers the view with Elgg's simplecache.
public getUrl ( string $view, string $subview = '' ) : string
$view string The full view name
$subview string If the first arg is "css" or "js", the rest of the view name
return string

init() public method

Set up config appropriately on engine boot.
public init ( ) : void
return void

invalidate() public method

Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every valid viewtype.
public invalidate ( ) : boolean
return boolean

isEnabled() public method

Is simple cache enabled
public isEnabled ( ) : boolean
return boolean

registerView() public method

Simple cache is a caching mechanism that saves the output of a view and its extensions into a file.
See also: elgg_get_simplecache_url()
public registerView ( string $view_name ) : void
$view_name string View name
return void