Elgg  Version 3.0
Public Member Functions | Protected Attributes | List of all members
Elgg\Cache\SimpleCache Class Reference

WARNING: API IN FLUX. More...

Public Member Functions

 __construct (Config $config, ViewsService $views)
 Constructor. More...
 
 getUrl ($view, $subview= '')
 Get the URL for the cached view. More...
 
 getRoot ()
 Get the base url for simple cache requests. More...
 
 isEnabled ()
 Is simple cache enabled. More...
 
 enable ()
 Enables the simple cache. More...
 
 disable ()
 Disables the simple cache. More...
 
 invalidate ()
 Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every valid viewtype. More...
 

Protected Attributes

 $config
 
 $views
 

Detailed Description

WARNING: API IN FLUX.

DO NOT USE DIRECTLY.

Definition at line 14 of file SimpleCache.php.

Constructor & Destructor Documentation

Elgg\Cache\SimpleCache::__construct ( Config  $config,
ViewsService  $views 
)

Constructor.

Parameters
Config$configElgg's global configuration
ViewsService$viewsViews service

Definition at line 32 of file SimpleCache.php.

Member Function Documentation

Elgg\Cache\SimpleCache::disable ( )

Disables the simple cache.

Warning
Simplecache is also purged when disabled.
See also
elgg_register_simplecache_view()
Returns
void

Definition at line 128 of file SimpleCache.php.

Elgg\Cache\SimpleCache::enable ( )

Enables the simple cache.

See also
elgg_register_simplecache_view()
Returns
void

Definition at line 115 of file SimpleCache.php.

Elgg\Cache\SimpleCache::getRoot ( )

Get the base url for simple cache requests.

Returns
string The simplecache root url for the current viewtype

Definition at line 89 of file SimpleCache.php.

Elgg\Cache\SimpleCache::getUrl (   $view,
  $subview = '' 
)

Get the URL for the cached view.

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.

Parameters
string$viewThe full view name
string$subviewIf the first arg is "css" or "js", the rest of the view name
Returns
string

Definition at line 64 of file SimpleCache.php.

Elgg\Cache\SimpleCache::invalidate ( )

Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every valid viewtype.

Returns
bool

Definition at line 151 of file SimpleCache.php.

Elgg\Cache\SimpleCache::isEnabled ( )

Is simple cache enabled.

Returns
bool

Definition at line 105 of file SimpleCache.php.

Member Data Documentation

Elgg\Cache\SimpleCache::$config
protected

Definition at line 19 of file SimpleCache.php.

Elgg\Cache\SimpleCache::$views
protected

Definition at line 24 of file SimpleCache.php.


The documentation for this class was generated from the following file: