Jump to content

ips_CacheRegistry -> getCache/_loadCaches


teraßyte

Recommended Posts

Posted

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.

Posted

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

Posted

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)

Posted

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;

      }
Posted

[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. ;)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...