Put the statement into the cache
767006
public function save() {
    if ($this->id != self::NO_CACHE) {
      $cache = ObjectFactory::getInstance('staticCache');
      $cache->put(self::getCacheSection($this->type), self::getCacheId($this->id), $this);
    }
  }
939457
def update_cache(self, data):
        """"""
        UTILS.update(self._cache, data)
        self._save_cache()
1041365
def put(self, result, decorated_function, *args, **kwargs):
		
		self.__check(decorated_function, *args, **kwargs)

		ref = weakref.ref(args[0])
		if decorated_function not in self._storage:
			cache_entry = self._cache_record_cls.create(result, decorated_function, *args, **kwargs)
			self._storage[decorated_function] = [{'instance': ref, 'result': cache_entry}]
		else:
			instance_found = False
			for i in self._storage[decorated_function]:
				if i['instance']() == args[0]:
					cache_entry = i['result']
					cache_entry.update(result, *args, **kwargs)
					instance_found = True
					break
			if instance_found is False:
				cache_entry = self._cache_record_cls.create(result, decorated_function, *args, **kwargs)
				self._storage[decorated_function].append({'instance': ref, 'result': cache_entry})

		def finalize_ref():
			if decorated_function in self._storage:
				fn_list = self._storage[decorated_function]
				if len(fn_list) == 1 and fn_list[0]['instance'] == ref:
					del self._storage[decorated_function]

				for i in range(len(fn_list)):
					if fn_list[i]['instance'] == ref:
						fn_list.pop(i)
						return

		weakref.finalize(args[0], finalize_ref)
1247563
def set(self, key, response):
        """"""
        mod = response.headers.pop('last-modified', None)
        status = int(response.status_code)
        rec = (key, status, mod, response.encoding, response.content,
               json.dumps(dict(response.headers)))
        with self._conn:
            self._conn.execute("DELETE FROM cache WHERE key=?", (key, ))
            self._conn.execute("INSERT INTO cache VALUES (?,?,?,?,?,?)", rec)
891011
function _prepareStatement()
    {
        $this->_statement = &$this->_db->prepare(
                'INSERT INTO ' . $this->_table .
                ' (id, logtime, ident, priority, message)' .
                ' VALUES(:id, :logtime, :ident, :priority, :message)',
                $this->_types, MDB2_PREPARE_MANIP);

        /* Return success if we didn't generate an error. */
        return (PEAR::isError($this->_statement) === false);
    }
338331
function set ( text, results ) {
	cache.push({
		text: trim(text),
		results: results
	});
}
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
648968
def commit(self):
        '''
        
        '''
        if self._fetched is None:
            raise RuntimeError('commit() was called but nothing was fetched')
        self._cache = self._cache[self._fetched:]
        self._fetched = None
594093
def commit(self):
        """"""
        if (not self._add_cache and
                not self._remove_cache and
                not self._undefined_cache):
            return

        for store_key, hash_values in self._add_cache.items():
            for hash_value in hash_values:
                super(TransactionalIndex, self).add_hashed_value(
                    hash_value, store_key)
        for store_key in self._remove_cache:
            super(TransactionalIndex, self).remove_key(store_key)
        for store_key in self._undefined_cache:
            super(TransactionalIndex, self).add_undefined(store_key)
        if not self.ephemeral:
            self.save_to_store()

        self._init_cache()
        self._in_transaction = True
525901
protected function setCache()
    {
        if ($this->cache) {
            $cacheFile = $this->getCacheFile();
            file_put_contents($cacheFile, $this->templateOutput);
        }
    }
493367
protected function prepareStatements()
    {
        if (!empty($this->statements)) {
            return;
        }
        $this->statements['load'] = $this->db->prepare(
            'SELECT * FROM `' . $this->options['table'] . '` WHERE `userId` = :userId '
            . 'AND `scope` = :scope AND `name` = :name AND `args` = :args'
        );

        $this->statements['save'] = $this->db->prepare(
            'INSERT INTO `' .
            $this->options['table'] .
            '` (`userId`, `scope`, `name`, `args`, `cachedUntil`, `xml`) VALUES ' .
            '(:userId, :scope, :name, :args, :cachedUntil, :xml)'
        );

        $this->statements['delete'] = $this->db->prepare(
            'DELETE FROM`' . $this->options['table'] . '` WHERE `userId` = :userId '
            . 'AND `scope` = :scope AND `name` = :name AND `args` = :args'
        );
    }
71551
def _put(self, item: SQLBaseObject):
        """"""
        if item._dto_type in self._expirations and self._expirations[item._dto_type] == 0:
            # The expiration time has been set to 0 -> shoud not be cached
            return
        item.updated()
        self._session().merge(item)
649229
def _add_to_cache(key, value):
    
    if key in _CACHE:
        _CACHE[key].append(value)
    else:
        _CACHE[key] = [_PATTERN, value]
        _CACHE_COUNTER[key] = 0
1366655
def cache(self, value):
        """"""
        value = bool(value)
        if self._cache and not value:
            self._clear()
        self._cache = value
6295
@Override
    public synchronized void run(){
        Date now = new Date();
        if ( !cache.isEmpty() &&
                ((cache.size() > cacheSize - 1) || (now.getTime() - lastCacheAccess.getTime() > cacheMillis))) {
            try {
                flush();
            } catch (RepositoryException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (MalformedQueryException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (UpdateExecutionException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (IOException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            }
        }
    }
447584
void executeStatement(String statement) {

		try (Connection conn = getFastConnection(); Statement stm = conn.createStatement()) {
			stm.execute(statement);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
175206
public function prepareStatements()
    {
        $addUpdateQuery = '';
        $addInsertQueryFields = '';
        $addInsertQueryValues = '';

        // create vars to keep statements dynamic
        foreach ($this->additionalFields as $value) {
            $addUpdateQuery .= ', ' . $value . ' = ?';
            $addInsertQueryFields .= ', ' . $value;
            $addInsertQueryValues .= ', ?';
        }

        // Statement to check if record already exists in db
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE searchStmt FROM "
			SELECT *
			FROM tx_kesearch_index
			WHERE orig_uid = ?
			AND pid = ?
			AND type = ?
			AND language = ?
			LIMIT 1
		"');

        // Statement to update an existing record in indexer table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE updateStmt FROM "
			UPDATE tx_kesearch_index
			SET pid=?,
			title=?,
			type=?,
			targetpid=?,
			content=?,
			tags=?,
			params=?,
			abstract=?,
			language=?,
			starttime=?,
			endtime=?,
			fe_group=?,
			tstamp=?' . $addUpdateQuery . '
			WHERE uid=?
		"');

        // Statement to insert a new records to index table
        $databaseConnection = Db::getDatabaseConnection('tx_kesearch_index');
        $databaseConnection->exec('PREPARE insertStmt FROM "
			INSERT INTO tx_kesearch_index
			(pid, title, type, targetpid, content, tags, params, abstract, language,'
            . ' starttime, endtime, fe_group, tstamp, crdate' . $addInsertQueryFields . ')
			VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . $addInsertQueryValues . ', ?)
		"');

        // disable keys only if indexer table was truncated (has 0 records)
        // this speeds up the first indexing process
        // don't use this for updating index table
        // if you activate this for updating 40.000 existing records, indexing process needs 1 hour longer
        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');
        $countIndex = $queryBuilder
            ->count('*')
            ->from('tx_kesearch_index')
            ->execute()
            ->fetchColumn(0);
        if ($countIndex == 0) {
            Db::getDatabaseConnection('tx_kesearch_index')->exec('ALTER TABLE tx_kesearch_index DISABLE KEYS');
        }
    }