Elgg  Version 5.1
Functions
cache.php File Reference

Go to the source code of this file.

Functions

 elgg_get_system_cache ()
 Elgg cache Cache file interface for caching data. More...
 
 elgg_reset_system_cache ()
 Reset the system cache by deleting the caches. More...
 
 elgg_save_system_cache (string $type, $data, int $expire_after=null)
 Saves a system cache. More...
 
 elgg_load_system_cache (string $type)
 Retrieve the contents of a system cache. More...
 
 elgg_delete_system_cache (string $type)
 Deletes 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 (string $view_name)
 Registers a view to simple cache. More...
 
 elgg_get_simplecache_url (string $view, string $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_invalidate_caches ()
 Invalidate all the registered caches. More...
 
 elgg_clear_caches ()
 Clear all the registered caches. More...
 
 elgg_purge_caches ()
 Purge all the registered caches. More...
 
 _elgg_is_cache_symlinked ()
 Checks if /cache directory has been symlinked to views simplecache directory. More...
 
 _elgg_symlink_cache ()
 Symlinks /cache directory to views simplecache directory. More...
 

Function Documentation

_elgg_is_cache_symlinked ( )

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

Returns
bool

Definition at line 226 of file cache.php.

_elgg_symlink_cache ( )

Symlinks /cache directory to views simplecache directory.

Returns
bool

Definition at line 244 of file cache.php.

elgg_clear_caches ( )

Clear all the registered caches.

Returns
void
Since
3.3

Definition at line 198 of file cache.php.

elgg_delete_system_cache ( string  $type)

Deletes the contents of a system cache.

Parameters
string$typeThe type of cache to delete
Returns
bool
Since
3.0

Definition at line 56 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 173 of file cache.php.

elgg_disable_system_cache ( )

Disables the system disk cache.

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

Returns
void

Definition at line 90 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 160 of file cache.php.

elgg_enable_system_cache ( )

Enables the system disk cache.

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

Returns
void

Definition at line 78 of file cache.php.

elgg_get_simplecache_url ( string  $view,
string  $subview = '' 
)

Get the URL for the cached view.

Recommended usage is to just pass the entire view name as the first and only arg:

1 $blog_js = elgg_get_simplecache_url('elgg/blog/save_draft.js');
2 $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:

1 $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
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 139 of file cache.php.

elgg_get_system_cache ( )

Elgg cache Cache file interface for caching data.

Returns an object suitable for caching system information

Returns

Definition at line 12 of file cache.php.

elgg_invalidate_caches ( )

Invalidate all the registered caches.

Returns
void
Since
3.3

Definition at line 183 of file cache.php.

elgg_is_simplecache_enabled ( )

Is simple cache enabled.

Returns
bool
Since
1.8.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 149 of file cache.php.

elgg_is_system_cache_enabled ( )

Is system cache enabled.

Returns
bool
Since
2.2.0

Definition at line 66 of file cache.php.

elgg_load_system_cache ( string  $type)

Retrieve the contents of a system cache.

Parameters
string$typeThe type of cache to load
Returns
mixed null if key not found in cache

Definition at line 45 of file cache.php.

elgg_purge_caches ( )

Purge all the registered caches.

This will remove all old/stale items from the caches

Returns
void
Since
3.3

Definition at line 213 of file cache.php.

elgg_register_simplecache_view ( string  $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.

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
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 111 of file cache.php.

elgg_reset_system_cache ( )

Reset the system cache by deleting the caches.

Returns
void

Definition at line 21 of file cache.php.

elgg_save_system_cache ( string  $type,
  $data,
int  $expire_after = null 
)

Saves a system cache.

Parameters
string$typeThe type or identifier of the cache
mixed$dataThe data to be saved
int$expire_afterNumber of seconds to expire the cache after
Returns
bool

Definition at line 34 of file cache.php.