def []=(key, value)
      hashed_key = hash_key(key)
      @store.transaction do
        entry = @store.new(Entry, key, value)

        if (existing_entry = @btree.get(hashed_key))
          # There is already an existing entry for this hashed key.
          if existing_entry.is_a?(Collisions)
            # Find the right index to insert the new entry. If there is
            # already an entry with the same key overwrite that entry.
            index_to_insert = 0
            overwrite = false
            existing_entry.each do |ae|
              if ae.key == key
                overwrite = true
                break
              end
              index_to_insert += 1
            end
            self.entry_counter += 1 unless overwrite
            existing_entry[index_to_insert] = entry
          elsif existing_entry.key == key
            # The existing value is for the identical key. We can safely
            # overwrite
            @btree.insert(hashed_key, entry)
          else
            # There is a single existing entry, but for a different key. Create
            # a new PEROBS::Array and store both entries.
            array_entry = @store.new(Collisions)
            array_entry << existing_entry
            array_entry << entry
            @btree.insert(hashed_key, array_entry)
            self.entry_counter += 1
          end
        else
          # No existing entry. Insert the new entry.
          @btree.insert(hashed_key, entry)
          self.entry_counter += 1
        end
      end
    end
def []=(key, value)
      hashed_key = hash_key(key)
      @store.transaction do
        entry = @store.new(Entry, key, value)

        if (existing_entry = @btree.get(hashed_key))
          # There is already an existing entry for this hashed key.
          if existing_entry.is_a?(Collisions)
            # Find the right index to insert the new entry. If there is
            # already an entry with the same key overwrite that entry.
            index_to_insert = 0
            overwrite = false
            existing_entry.each do |ae|
              if ae.key == key
                overwrite = true
                break
              end
              index_to_insert += 1
            end
            self.entry_counter += 1 unless overwrite
            existing_entry[index_to_insert] = entry
          elsif existing_entry.key == key
            # The existing value is for the identical key. We can safely
            # overwrite
            @btree.insert(hashed_key, entry)
          else
            # There is a single existing entry, but for a different key. Create
            # a new PEROBS::Array and store both entries.
            array_entry = @store.new(Collisions)
            array_entry << existing_entry
            array_entry << entry
            @btree.insert(hashed_key, array_entry)
            self.entry_counter += 1
          end
        else
          # No existing entry. Insert the new entry.
          @btree.insert(hashed_key, entry)
          self.entry_counter += 1
        end
      end
    end
Insert a value that is associated with the given key. If a value for
 this key already exists, the value will be overwritten with the newly
 provided value.
 @param key [Integer or String]
 @param value [Any PEROBS storable object]