Save item to the pool
@param CacheItemInterface $item The item to save
@return bool True
183897
public function save(CacheItemInterface $item)
    {
        $this->cache->set($item->getKey(), $item);
        return $this->commit();
    }
1263867
public function save( \Aimeos\MShop\Subscription\Item\Iface $item )
	{
		return $this->manager->saveItem( $item );
	}
674476
public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )
	{
		$iface = 'MAdmin_Cache_Item_Interface';
		if( !( $item instanceof $iface ) ) {
			throw new MAdmin_Cache_Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
		}

		if( ! $item->isModified() ) {
			return;
		}

		/** madmin/cache/manager/default/set
		 * Inserts the cache entry into the database
		 *
		 * The ID, value and expiration timestamp are inserted as new record
		 * into the cache database. Any existing record must be deleted before
		 * the new one can be inserted.
		 *
		 * The SQL statement must be a string suitable for being used as
		 * prepared statement. It must include question marks for binding
		 * the values from the cache item to the statement before they are
		 * sent to the database server. The number of question marks must
		 * be the same as the number of columns listed in the INSERT
		 * statement. The order of the columns must correspond to the
		 * order in the set() method, so the correct values are bound to the
		 * columns.
		 *
		 * The SQL statement should conform to the ANSI standard to be
		 * compatible with most relational database systems. This also
		 * includes using double quotes for table and column names.
		 *
		 * @param string SQL statement for inserting a new cache entry
		 * @since 2014.03
		 * @category Developer
		 * @see madmin/cache/manager/default/delete
		 * @see madmin/cache/manager/default/deletebytag
		 * @see madmin/cache/manager/default/get
		 * @see madmin/cache/manager/default/getbytag
		 * @see madmin/cache/manager/default/settag
		 * @see madmin/cache/manager/default/search
		 * @see madmin/cache/manager/default/count
		 */

		/** madmin/cache/manager/default/settag
		 * Inserts a new tag to an existing cache entry
		 *
		 * The ID of the cache entry and the tag name are inserted as a new
		 * record into the cache database. Any existing tag record that
		 * conflicts with the new one must be deleted before it can be inserted.
		 *
		 * The SQL statement must be a string suitable for being used as
		 * prepared statement. It must include question marks for binding
		 * the cache ID and tag name from the cache item to the statement
		 * before they are sent to the database server. The number of question
		 * marks must be the same as the number of columns listed in the INSERT
		 * statement. The order of the columns must correspond to the order in
		 * the saveItems() method, so the correct values are bound to the
		 * columns.
		 *
		 * The SQL statement should conform to the ANSI standard to be
		 * compatible with most relational database systems. This also
		 * includes using double quotes for table and column names.
		 *
		 * @param string SQL statement for inserting a new tag to an existing cache entry
		 * @since 2014.03
		 * @category Developer
		 * @see madmin/cache/manager/default/delete
		 * @see madmin/cache/manager/default/deletebytag
		 * @see madmin/cache/manager/default/get
		 * @see madmin/cache/manager/default/getbytag
		 * @see madmin/cache/manager/default/set
		 * @see madmin/cache/manager/default/search
		 * @see madmin/cache/manager/default/count
		 */

		$id = $item->getId();
		$cache = $this->getCache();

		$cache->delete( $id );
		$cache->set( $id, $item->getValue(), $item->getTags(), $item->getTimeExpire() );
	}
1126895
private function saveContainerToCache($cachefile)
    {
        $dumper = new PhpDumper($this->symfonyContainer);
        file_put_contents($cachefile, $dumper->dump());
    }
1202782
private function hasValidCacheItem(CacheItemInterface $cacheItem, array $fieldList) : bool
    {
        $data = $cacheItem->get();
        if (is_null($data)) {
            return false;
        }

        $fieldDiff = array_diff($fieldList, array_keys($data));

        return !$fieldDiff;
    }
1265533
public function set(CacheItem $item): self
    {
        $driver = $this->getDriver();
        $driver->set($item->key, $item->value, $item->ttl);
        if ($this->hasEventListeners('itemSet')) {
            $this->dispatchEvent('itemSet', new \BearFramework\App\Cache\ItemSetEventDetails(clone($item)));
        }
        if ($this->hasEventListeners('itemChange')) {
            $this->dispatchEvent('itemChange', new \BearFramework\App\Cache\ItemChangeEventDetails($item->key));
        }
        return $this;
    }
1197743
public function release($item)
	{
		// search the item in the used items array
		$k = array_search($item, $this->_inUseItems);
		if ( $k === FALSE )
			return;
			
		// remove it from the used items and adding it to the pool
		unset($this->_inUseItems[$k]);
		$this->_poolItems[] = $item;
	}
1080053
public function stampedeProtect(EventInterface $event)/*# : bool */
    {
        /* @var CachePool $pool */
        $pool = $event->getTarget();
        /* @var CacheItem $item */
        $item = $event->getParam('item');

        if ($item instanceof CacheItemExtendedInterface) {
            $left = $item->getExpiration()->getTimestamp() - time();
            if ($left < $this->time_left && rand(1, 1000) <= $this->probability) {
                return $pool->setError(
                    Message::get(Message::CACHE_EXT_STAMPEDE, $item->getKey()),
                    Message::CACHE_EXT_STAMPEDE
                );
            }
        }

        return true;
    }
986220
public function save(Process $process, array $item)
    {
        $this->initiateMemoryProcess($process);
        $this->memory[$process->getId()][] = json_encode($item);
    }
792370
public function saveItem(StorableInterface $item)
    {
        if ($this->tableExists() === false) {
            /** @todo Optionnally turn off for some models */
            $this->createTable();
        }

        if ($item !== null) {
            $this->setModel($item);
        }
        $model  = $this->model();
        $table  = $this->table();
        $struct = array_keys($this->tableStructure());
        $fields = $this->getModelFields($model);

        $keys   = [];
        $values = [];
        $binds  = [];
        $types  = [];
        foreach ($fields as $field) {
            $key = $field->ident();
            if (in_array($key, $struct)) {
                $keys[]      = '`'.$key.'`';
                $values[]    = ':'.$key.'';
                $binds[$key] = $field->val();
                $types[$key] = $field->sqlPdoType();
            }
        }

        $query = '
            INSERT
                INTO
            `'.$table.'`
                ('.implode(', ', $keys).')
            VALUES
                ('.implode(', ', $values).')';

        $result = $this->dbQuery($query, $binds, $types);

        if ($result === false) {
            throw new PDOException('Could not save item.');
        } else {
            if ($model->id()) {
                return $model->id();
            } else {
                return $this->db()->lastInsertId();
            }
        }
    }
1124401
public function save($key, CacheEntry $data)
    {
        try {
            return wp_cache_set($key, serialize($data), $this->group, $data->getTTL());
        } catch (\Exception $ignored) {
            // Don't fail if we can't save it
        }

        return false;
    }
1001074
public function saveData($item)
    {
        $attributes = $item->dataProperties->getAttributesForSave($item->id);
        if(empty($attributes)) return false;

        $classData = static::getClassData();

        foreach ($attributes as $slug => $values)
        {

            $classData::deleteAll(['item_id' => $item->id, 'property_slug' => $slug]);
            $values = (is_array($values)) ? $values : [$values];

            foreach ($values as $value){

                $value = (is_array($value)) ? array_values($value)[0] : $value;

                $data = new $classData;
                $data->value = $value;
                $data->property_slug = $slug;
                $data->item_id = $item->id;
                if(!empty($value)) $data->save();
            }
        }
    }
850338
public function finish(array $items = []): bool
    {
        $changed = false;

        foreach ($items as $key => $value) {
            $serialized = \serialize($value);

            if (! $this->check($key, $serialized)) {
                $changed = true;

                try {
                    $this->saving($key, $serialized, $this->isNewKey($key));
                } catch (PDOException $e) {
                    // Should be able to ignore failure since it is possible that
                    // the request is done on a read only connection.
                }
            }
        }

        if ($changed && $this->cache instanceof Repository) {
            $this->cache->forget($this->cacheKey);
        }

        return true;
    }
1234083
public function save(CacheItemInterface $item)
    {
        $expirationTime = null;

        if ($item instanceof ExtractableCacheLifetimeInterface) {
            $expirationTime = $item->getCacheLifetime();
        }

        return $this->cacheFrontend->save(
            serialize((
                $item instanceof ExtractableCacheValueInterface ?
                    $item->getCacheValue() :
                    $item->get()
            )),
            $this->prepareKey($item->getKey()),
            $this->tags,
            $expirationTime
        );
    }
831989
private function isExpired(CacheItemInterface $item, DateTime $time = null)
    {
        $time = $time ?: new DateTime();
        return ($time > $item->getExpiresAt());
    }
442129
public function monitor($item)
    {
        if ($item instanceof PoolInterface) {
            $item->addListener(PoolRunEvent::POOL_RUN_ADDED, [$this, 'onPoolRunAdded']);
            $item->addListener(PoolRunEvent::UPDATED, [$this, 'onPoolUpdated']);
            array_map([$this, 'monitor'], $item->getAll());
        }
        if ($item instanceof RunInterface) {
            $item->addListener(RunEvent::STARTED, [$this, 'onRunStarted']);
            $item->addListener(RunEvent::SUCCESSFUL, [$this, 'onRunSuccessful']);
            $item->addListener(RunEvent::FAILED, [$this, 'onRunFailed']);
            $item->addListener(RunEvent::COMPLETED, [$this, 'onRunCompleted']);
        }
    }
1156599
public function set(CacheableInterface $item)
    {
        $this->connection->set($item->getHashKey(), $item->getDataForCache(), $item->getTtl());
    }