Beispiel #1
0
 public function testPutOverridesGetCallback()
 {
     $pool = new MemoryPool();
     $result = $pool->get('foo', function () {
         return 1;
     });
     $this->assertEquals(1, $result);
     $pool->put('foo', 2);
     $result = $pool->get('foo', function () {
         return 3;
     });
     $this->assertEquals(2, $result);
 }
Beispiel #2
0
 /**
  * Cache a reference to this plugin by its ID
  * 
  * @param \ElggPlugin $plugin
  * 
  * @access private
  */
 function cache(\ElggPlugin $plugin)
 {
     $this->plugins_by_id->put($plugin->getID(), $plugin);
 }