Jaxel Well-known member Jan 8, 2018 #1 A place where I can store innocuous data? Code: $discord = XenForo_Application::getSimpleCacheData('discord');
A place where I can store innocuous data? Code: $discord = XenForo_Application::getSimpleCacheData('discord');
Snog Well-known member Jan 8, 2018 #2 Code: $simpleCache = $this->app->simpleCache(); $simpleCache['Your/Addon']['discord'] = $discord; // SET CACHE $discord = $simpleCache['Your/Addon']['discord']; // GET CACHE
Code: $simpleCache = $this->app->simpleCache(); $simpleCache['Your/Addon']['discord'] = $discord; // SET CACHE $discord = $simpleCache['Your/Addon']['discord']; // GET CACHE
Jaxel Well-known member Jan 8, 2018 #3 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?
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?
Chris D XenForo developer Staff member Jan 8, 2018 #4 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.
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.