teraßyte Posted May 21, 2009 Posted May 21, 2009 I am in the process of converting the global shoutbox and I've come across an issue with the caches. In IPB 2.3 was possible to use init_load_cache to load an array of caches at once but now in IPB 3 this is not possible anymore, the only way is to use $this->cache->getCache('cache_name') but in this way I need to use 3 different queries to load 3 caches. A quick solution would be to change the function _loadCache from private to public so everyone can access it or update the function getCache to support an array of caches.
rct2·com Posted May 21, 2009 Posted May 21, 2009 Can you not manage this through you app's coreVariables.php? At least, that's how I understood it based on the article. http://resources.invisionpower.com/index.php?appcomponent=cms&module=articles&article=7508
teraßyte Posted May 21, 2009 Author Posted May 21, 2009 No I can't, the global shoutbox is an Hook so I can't load the shoutbox coreVariables.php :)
bfarber Posted May 21, 2009 Posted May 21, 2009 You could within the application itself, but not outside the application. @terabyte, cleaned way is to support an array of caches. Good suggestion. Easy to implement in next release (e.g. 3.0.1)
teraßyte Posted May 21, 2009 Author Posted May 21, 2009 I was hoping that you implement this small change for 3.0.0 :( Actually I have already rewritten the function on my own just for fun lol static public function getCache( $keys ) { if ( is_string( $keys ) ) { if ( ! in_array( $keys, array_keys( self::$data_store ) ) ) { self::_loadCaches( array( $keys ) ); } return self::$data_store[ $keys ]; } elseif ( is_array( $keys ) && count( $keys ) ) { $toLoad = array(); foreach( $keys as $key ) { if ( ! in_array( $key, array_keys( self::$data_store ) ) ) { $toLoad[] = $key; } } self::_loadCaches( $toLoad ); return TRUE; } return FALSE; }
bfarber Posted May 22, 2009 Posted May 22, 2009 Fine fine fine, since you twisted my arm (and *ahem* wrote the code yourself)
teraßyte Posted May 22, 2009 Author Posted May 22, 2009 *Terabyte gives Brandon a huge kiss* :wub: :lol:
Strike X Posted May 22, 2009 Posted May 22, 2009 [quote name='teraßyte' date='22 May 2009 - 07:18 AM' timestamp='1242973122' post='1804300'] *Terabyte gives Brandon a huge kiss* :wub: :o :o Good luck. ;)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.