Add an index to the index cache for ensure_index operations.
422736
def _cache_index(self, dbname, collection, index, cache_for):
        """"""
        now = datetime.datetime.utcnow()
        expire = datetime.timedelta(seconds=cache_for) + now

        with self.__index_cache_lock:
            if dbname not in self.__index_cache:
                self.__index_cache[dbname] = {}
                self.__index_cache[dbname][collection] = {}
                self.__index_cache[dbname][collection][index] = expire

            elif collection not in self.__index_cache[dbname]:
                self.__index_cache[dbname][collection] = {}
                self.__index_cache[dbname][collection][index] = expire

            else:
                self.__index_cache[dbname][collection][index] = expire
295470
private void addMissingBlanks(final int index) {
        if (this.capacity <= index) {
            this.capacity = index * 2;
            final E[] newArr = (E[]) new Object[this.capacity];
            System.arraycopy(this.arr, 0, newArr, 0, this.size);
            this.arr = newArr;
        }
        if (this.blankElement != null) {
            Arrays.fill(this.arr, this.size, index, this.blankElement);
        }
        this.size = index + 1;
    }
11927
def add_index(self, new_index, index_table):
    
    self.send_add_index(new_index, index_table)
    return self.recv_add_index()
339085
def flush_to_index(self):
        """"""
        assert self._smref is not None
        # should always have a file here
        assert not isinstance(self._file_or_files, BytesIO)

        sm = self._smref()
        if sm is not None:
            index = self._index
            if index is None:
                index = sm.repo.index
            # END handle index
            index.add([sm.k_modules_file], write=self._auto_write)
            sm._clear_cache()
280497
def insert(cls, index, interceptor):
        
        cls._check(interceptor)
        cls._interceptors.insert(index, interceptor)
69048
@TimerJ
    public TableMetadataBuilder addIndex(IndexMetadata indexMetadata) {
        indexes.put(indexMetadata.getName(), indexMetadata);
        return this;
    }
1318772
def ensure_indexes(self):
        """"""
        for collection_name in INDEXES:
            existing_indexes = self.indexes(collection_name)
            indexes = INDEXES[collection_name]
            for index in indexes:
                index_name = index.document.get('name')
                if index_name in existing_indexes:
                    logger.debug("Index exists: %s" % index_name)
                    self.db[collection_name].drop_index(index_name)
            logger.info("creating indexes for collection {0}: {1}".format(
                collection_name,
                ', '.join([index.document.get('name') for index in indexes]),
                )
            )
            self.db[collection_name].create_indexes(indexes)
581676
def add_index_boost(self, index, boost):
        
        if boost is None:
            if index in self.index_boost:
                del(self.index_boost[index])
        else:
            self.index_boost[index] = boost
        return self
1191521
private void addIndex(final String index) throws IOException {

        logger.info("Adding index '{}'...", index);

        String resourcePath = "/" + index;

        if (doesResourceNotExist(resourcePath)) {

            try {
                elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath);

                logger.info("Added '{}' index", index);
            } catch (ResponseException e) {

                boolean errorCreatingIndex = true;

                Response errorResponse = e.getResponse();
                if (errorResponse.getStatusLine().getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
                    JsonNode root = objectMapper.readTree(EntityUtils.toString(errorResponse.getEntity()));
                    String errorCode = root.get("error").get("type").asText();
                    if ("index_already_exists_exception".equals(errorCode)) {
                        errorCreatingIndex = false;
                    }
                }

                if (errorCreatingIndex) {
                    throw e;
                }
            }
        } else {
            logger.info("Index '{}' already exists", index);
        }
    }
85634
def add_to_cache(self, cache_id, inputs, output):
        """"""
        self.inputs_changed[cache_id] = False
        self.cached_outputs[cache_id] = output
        self.order.append(cache_id)
        self.cached_inputs[cache_id] = inputs
        for a in inputs:
            if a is not None and not isinstance(a, Number) and not isinstance(a, str):
                ind_id = self.id(a)
                v = self.cached_input_ids.get(ind_id, [weakref.ref(a), []])
                v[1].append(cache_id)
                if len(v[1]) == 1:
                    a.add_observer(self, self.on_cache_changed)
                self.cached_input_ids[ind_id] = v
379349
def add_index_alias(es, index_name, alias_name):
    """"""

    es.indices.put_alias(index=index_name, name=terms_alias)
74313
def load_index_from_cache(self):
        '''  '''

        cache = open(self.cache_path_index, 'r')
        json_index = cache.read()
        self.index = json.loads(json_index)
202604
public function hook_indexContent()
    {
        $this->addPageToSitemapIndex();

        $possibility = (int)GeneralUtility::getExtConf('sitemap_clearCachePossibility', 0);

        if ($possibility > 0) {
            $clearCacheChance = ceil(mt_rand(0, $possibility));
            if ($clearCacheChance == 1) {
                SitemapUtility::expire();
            }
        }
    }
815195
def add_value(self, value, index_point):
        """"""
        if index_point not in self.index:
            self.values.append(value)
            self.index.append(index_point)
54165
public function addIndex($type, $index)
    {
        if (!isset($this->indexes[$type])) {
            $this->indexes[$type] = [];
        }

        $this->indexes[$type][] = $index;
    }
295455
def insert(self, index, x):
        
        self.check_insertion(x)

        self.real_list.insert(index, x)
        self._items |= {x}
702949
def ensure_index(self, key, unique=False):
        
        return self.collection.ensure_index(key, unique=unique)