Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Namespaces | Functions | Variables
cache.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 elgg_get_system_cache ()
 Returns an object suitable for caching system information. More...
 
 elgg_reset_system_cache ()
 Reset the system cache by deleting the caches. More...
 
 elgg_save_system_cache ($type, $data)
 Saves a system cache. More...
 
 elgg_load_system_cache ($type)
 Retrieve the contents of a system cache. More...
 
 elgg_is_system_cache_enabled ()
 Is system cache enabled. More...
 
 elgg_enable_system_cache ()
 Enables the system disk cache. More...
 
 elgg_disable_system_cache ()
 Disables the system disk cache. More...
 
 elgg_register_simplecache_view ($view_name)
 Registers a view to simple cache. More...
 
 elgg_get_simplecache_url ($view, $subview= '')
 Get the URL for the cached view. More...
 
 elgg_is_simplecache_enabled ()
 Is simple cache enabled. More...
 
 elgg_enable_simplecache ()
 Enables the simple cache. More...
 
 elgg_disable_simplecache ()
 Disables the simple cache. More...
 
 _elgg_rmdir ($dir, $empty=false)
 Recursively deletes a directory, including all hidden files. More...
 
 elgg_invalidate_simplecache ()
 Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every valid viewtype. More...
 
 elgg_flush_caches ()
 Flush all the registered caches. More...
 
 _elgg_is_cache_symlinked ()
 Checks if /cache directory has been symlinked to views simplecache directory. More...
 
 _elgg_cache_init ()
 Initializes the simplecache lastcache variable and creates system cache files when appropriate. More...
 

Variables

return function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks)
 

Function Documentation

_elgg_cache_init ( )

Initializes the simplecache lastcache variable and creates system cache files when appropriate.

private

Definition at line 247 of file cache.php.

_elgg_is_cache_symlinked ( )

Checks if /cache directory has been symlinked to views simplecache directory.

Returns
bool private

Definition at line 235 of file cache.php.

_elgg_rmdir (   $dir,
  $empty = false 
)

Recursively deletes a directory, including all hidden files.

TODO(ewinslow): Move to filesystem package

Parameters
string$dirThe directory
bool$emptyIf true, we just empty the directory
Returns
boolean Whether the dir was successfully deleted. private

Definition at line 185 of file cache.php.

elgg_disable_simplecache ( )

Disables the simple cache.

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

Definition at line 170 of file cache.php.

elgg_disable_system_cache ( )

Disables the system disk cache.

Uses the 'system_cache_enabled' datalist with a boolean value. Resets the system cache.

Returns
void

Definition at line 84 of file cache.php.

elgg_enable_simplecache ( )

Enables the simple cache.

See Also
elgg_register_simplecache_view()
Returns
void
Since
1.8.0

Definition at line 157 of file cache.php.

elgg_enable_system_cache ( )

Enables the system disk cache.

Uses the 'system_cache_enabled' datalist with a boolean value. Resets the system cache.

Returns
void

Definition at line 72 of file cache.php.

elgg_flush_caches ( )

Flush all the registered caches.

Returns
void
Since
1.11

Definition at line 225 of file cache.php.

elgg_get_simplecache_url (   $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 = elgg_get_simplecache_url('elgg/blog/save_draft.js'); $favicon = elgg_get_simplecache_url('favicon.ico'); ```

For backwards compatibility with older versions of Elgg, this function supports "js" or "css" as the first arg, with the rest of the view name as the second arg:

``` $blog_js = elgg_get_simplecache_url('js', 'elgg/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
Since
1.8.0

Definition at line 136 of file cache.php.

elgg_get_system_cache ( )

Returns an object suitable for caching system information.

Returns

Definition at line 20 of file cache.php.

elgg_invalidate_simplecache ( )

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

Returns
bool
Since
1.7.4

Definition at line 215 of file cache.php.

elgg_is_simplecache_enabled ( )

Is simple cache enabled.

Returns
bool
Since
1.8.0

Definition at line 146 of file cache.php.

elgg_is_system_cache_enabled ( )

Is system cache enabled.

Returns
bool
Since
2.2.0

Definition at line 60 of file cache.php.

elgg_load_system_cache (   $type)

Retrieve the contents of a system cache.

Parameters
string$typeThe type of cache to load
Returns
string

Definition at line 50 of file cache.php.

elgg_register_simplecache_view (   $view_name)

Registers a view to simple cache.

Simple cache is a caching mechanism that saves the output of a view and its extensions into a file. If the view is called by the engine/handlers/cache_handler.php file, the Elgg engine will not be loaded and the contents of the view will returned from file.

Warning
Simple cached views must take no parameters and return the same content no matter who is logged in.
Parameters
string$view_nameView name
Returns
void
See Also
elgg_get_simplecache_url()
Since
1.8.0

Definition at line 108 of file cache.php.

elgg_reset_system_cache ( )

Reset the system cache by deleting the caches.

Returns
void

Definition at line 29 of file cache.php.

elgg_save_system_cache (   $type,
  $data 
)

Saves a system cache.

Parameters
string$typeThe type or identifier of the cache
string$dataThe data to be saved
Returns
bool

Definition at line 40 of file cache.php.

Variable Documentation

Definition at line 252 of file cache.php.