original_string: public function initialise(cache_definition $definition) {
          if ($this->is_initialised()) {
              throw new coding_exception('This mongodb instance has already been initialised.');
          }
          $this->database = $this->connection->selectDatabase($this->databasename);
          $this->definitionhash = 'm'.$definition->generate_definition_hash();
          $this->collection = $this->database->selectCollection($this->definitionhash);
  
          $options = array('name' => 'idx_key');
  
          $w = $this->usesafe ? 1 : 0;
          $wc = new MongoDB\Driver\WriteConcern($w);
  
          $options['writeConcern'] = $wc;
  
          $this->collection->createIndex(array('key' => 1), $options);
      }
code: public function initialise(cache_definition $definition) {
          if ($this->is_initialised()) {
              throw new coding_exception('This mongodb instance has already been initialised.');
          }
          $this->database = $this->connection->selectDatabase($this->databasename);
          $this->definitionhash = 'm'.$definition->generate_definition_hash();
          $this->collection = $this->database->selectCollection($this->definitionhash);
  
          $options = array('name' => 'idx_key');
  
          $w = $this->usesafe ? 1 : 0;
          $wc = new MongoDB\Driver\WriteConcern($w);
  
          $options['writeConcern'] = $wc;
  
          $this->collection->createIndex(array('key' => 1), $options);
      }
code_tokens: public function initialise ( cache_definition $ definition ) { if ( $ this -> is_initialised ( ) ) { throw new coding_exception ( 'This mongodb instance has already been initialised.' ) ; } $ this -> database = $ this -> connection -> selectDatabase ( $ this -> databasename ) ; $ this -> definitionhash = 'm' . $ definition -> generate_definition_hash ( ) ; $ this -> collection = $ this -> database -> selectCollection ( $ this -> definitionhash ) ; $ options = array ( 'name' => 'idx_key' ) ; $ w = $ this -> usesafe ? 1 : 0 ; $ wc = new MongoDB \ Driver \ WriteConcern ( $ w ) ; $ options [ 'writeConcern' ] = $ wc ; $ this -> collection -> createIndex ( array ( 'key' => 1 ) , $ options ) ; }
docstring: Initialises the store instance for use.
  
  Once this has been done the cache is all set to be used.
  
  @param cache_definition $definition
  @throws coding_exception
docstring_tokens: Initialises the store instance for use .