XF 2.0 Does XF2 have anything like the XF1 simple cache?

Jaxel

Well-known member
A place where I can store innocuous data?
Code:
$discord = XenForo_Application::getSimpleCacheData('discord');
 
Code:
$simpleCache = $this->app->simpleCache();

$simpleCache['Your/Addon']['discord'] = $discord; // SET CACHE

$discord = $simpleCache['Your/Addon']['discord']; // GET CACHE
 
I also found the data registry:
Code:
\XF::registry()->set('discord', $discord);

Is there a reason to use the simple cache over the registry, or vice-versa?
 
The simple cache is pre loaded so reads from it have no query overhead. It’s also geared towards add on usage - it’s internally keyed by add on ID so data can be removed automatically on add on uninstall.
 
Back
Top Bottom