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');
};