Elgg  Version 1.11
/root/Elgg/engine/lib/cache.php

Get the URL for the cached fileThis automatically registers the view with Elgg's simplecache.

$blog_js = elgg_get_simplecache_url('js', 'blog/save_draft'); elgg_register_js('elgg.blog', $blog_js); elgg_load_js('elgg.blog');

Parameters
string$typeThe file type: css or js
string$viewThe view name after css/ or js/
Returns
string
Since
1.8.0
<?php
/* Filepath Cache */
return _elgg_services()->systemCache->getFileCache();
}
_elgg_services()->systemCache->reset();
}
return _elgg_services()->systemCache->save($type, $data);
}
return _elgg_services()->systemCache->load($type);
}
_elgg_services()->systemCache->enable();
}
_elgg_services()->systemCache->disable();
}
/* Simplecache */
function elgg_register_simplecache_view($view_name) {
_elgg_services()->simpleCache->registerView($view_name);
}
return _elgg_services()->simpleCache->getUrl($type, $view);
}
return _elgg_services()->simpleCache->getRoot();
}
if (preg_match('~(?:^|/)(css|js)(?:$|/)~', $view, $m)) {
return $m[1];
} else {
return 'unknown';
}
}
return _elgg_services()->simpleCache->isEnabled();
}
_elgg_services()->simpleCache->enable();
}
_elgg_services()->simpleCache->disable();
}
function _elgg_rmdir($dir) {
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if (is_dir("$dir/$file")) {
_elgg_rmdir("$dir/$file");
} else {
unlink("$dir/$file");
}
}
return rmdir($dir);
}
_elgg_services()->simpleCache->invalidate();
}
function _elgg_cache_init() {
_elgg_services()->simpleCache->init();
_elgg_services()->systemCache->init();
}
return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
$events->registerHandler('ready', 'system', '_elgg_cache_init');
};
$files
Definition: crop.php:36
$view
Definition: crop.php:68
$type
Definition: add.php:8
_elgg_services()
Definition: autoloader.php:14
_elgg_cache_init()
Initializes the simplecache lastcache variable and creates system cache files when appropriate.
Definition: cache.php:230
elgg_reset_system_cache()
Reset the system cache by deleting the caches.
Definition: cache.php:29
elgg_invalidate_simplecache()
Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every...
Definition: cache.php:220
elgg_load_system_cache($type)
Retrieve the contents of a system cache.
Definition: cache.php:50
_elgg_get_view_filetype($view)
Returns the type of output expected from the view.
Definition: cache.php:148
elgg_is_simplecache_enabled()
Is simple cache enabled.
Definition: cache.php:162
_elgg_rmdir($dir)
Recursively deletes a directory, including all hidden files.
Definition: cache.php:199
elgg_disable_system_cache()
Disables the system disk cache.
Definition: cache.php:74
_elgg_get_simplecache_root()
Get the base url for simple cache requests.
Definition: cache.php:128
elgg_enable_simplecache()
Enables the simple cache.
Definition: cache.php:173
elgg_disable_simplecache()
Disables the simple cache.
Definition: cache.php:186
elgg_save_system_cache($type, $data)
Saves a system cache.
Definition: cache.php:40
elgg_get_system_cache()
Returns an \ElggCache object suitable for caching system information.
Definition: cache.php:20
elgg_get_simplecache_url($type, $view)
Definition: cache.php:117
elgg_register_simplecache_view($view_name)
Registers a view to simple cache.
Definition: cache.php:98
elgg_enable_system_cache()
Enables the system disk cache.
Definition: cache.php:62
$data
Definition: opendd.php:13
$m
Definition: metadata.php:11