• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Generic Cache

digitalpoint

Well-known member
#1
There's something I want to do that really should be cached...

Is there some sort of generic caching mechanism in XenForo that I can't find (basically the equivalent of vBulletin's datastore)?

I suppose I could drop it into a hidden option or something, but that seems terribly inelegant.
 
R

ragtek

Guest
#2
1. You can use the Zend Cache. (Like vB_Cache)

2.
Check XenForo_Dependencies_Public

PHP:
class XenForo_Dependencies_Public extends XenForo_Dependencies_Abstract
{
	/**
	 * List of data to pre-load from the data registry. You must process this data
	 * via {@link _handleCustomPreLoadedData()}.
	 *
	 * @var array
	 */
	protected $_dataPreLoadFromRegistry = array(
		'routesPublic', 'nodeTypes',
		'bannedIps', 'discouragedIps',
		'styles', 'displayStyles', 'smilies', 'bbCode',
		'trophyUserTitles', 'reportCounts', 'moderationCounts'
	);
/**
	 * Handles the custom data that needs to be preloaded.
	 *
	 * @param array $data Data that was loaded. Unsuccessfully loaded items will have a value of null
	 */
	protected function _handleCustomPreloadedData(array &$data)
I've never used it, but here http://xenforo.com/community/threads/xenmoods.5885/ you can see how dismounted is using it in his add-on^^
 

digitalpoint

Well-known member
#3
Ah... "data_registry". I was looking through the tables trying to figure out where such a cache would be stored and couldn't find it. Knowing you would need to fallback to a database storage if the user didn't have any memory cache mechanisms installed, I figured it would be the best place to look and I missed that table. :)

Exactly what I was looking for... thanks. :)