function it_removes_all_items_by_ids() { $this->cacheFrontend->remove('prefix_key1')->willReturn(true)->shouldBeCalled(); $this->cacheFrontend->remove('prefix_key2')->willReturn(true)->shouldBeCalled(); $this->cacheFrontend->remove('prefix_key3')->willReturn(true)->shouldBeCalled(); $this->deleteItems(['key1', 'key2', 'key3'])->shouldReturn(true); }
/** * Remove cached data by identifier * * @param string $identifier * @return bool */ public function remove($identifier) { return $this->_frontend->remove($identifier); }
/** * Reset cached DDL data from cache * if table name is null - reset all cached DDL data * * @param string $tableName * @param string $schemaName OPTIONAL * @return $this */ public function resetDdlCache($tableName = null, $schemaName = null) { if (!$this->_isDdlCacheAllowed) { return $this; } if ($tableName === null) { $this->_ddlCache = array(); if ($this->_cacheAdapter) { $this->_cacheAdapter->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(self::DDL_CACHE_TAG)); } } else { $cacheKey = $this->_getTableName($tableName, $schemaName); $ddlTypes = array(self::DDL_DESCRIBE, self::DDL_CREATE, self::DDL_INDEX, self::DDL_FOREIGN_KEY); foreach ($ddlTypes as $ddlType) { unset($this->_ddlCache[$ddlType][$cacheKey]); } if ($this->_cacheAdapter) { foreach ($ddlTypes as $ddlType) { $cacheId = $this->_getCacheId($cacheKey, $ddlType); $this->_cacheAdapter->remove($cacheId); } } } return $this; }
/** * Save configurable product depended data * * @param \Magento\Catalog\Model\Product $product * @return $this * @throws \InvalidArgumentException * @deprecated the \Magento\ConfigurableProduct\Model\Product\SaveHandler::execute should be used instead */ public function save($product) { parent::save($product); $cacheId = __CLASS__ . $product->getId(); $this->cache->remove($cacheId); $extensionAttributes = $product->getExtensionAttributes(); // this approach is needed for 3rd-party extensions which are not using extension attributes if (empty($extensionAttributes->getConfigurableProductOptions())) { $this->saveConfigurableOptions($product); } if (empty($extensionAttributes->getConfigurableProductLinks())) { $this->saveRelatedProducts($product); } return $this; }
/** * Removes the item from the pool. * * @param string $key * The key for which to delete * * @throws InvalidArgumentException * If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException * MUST be thrown. * * @return bool * True if the item was successfully removed. False if there was an error. */ public function deleteItem($key) { return $this->cacheFrontend->remove($this->prepareKey($key)); }
/** * Remove notification from cache * * @param string $notificationType * @param string $customerId * @return void */ public function remove($notificationType, $customerId) { $this->cache->remove($this->getCacheKey($notificationType, $customerId)); }
/** * Save configurable product depended data * * @param \Magento\Catalog\Model\Product $product * @return $this * @throws \InvalidArgumentException * @deprecated the \Magento\ConfigurableProduct\Model\Product\SaveHandler::execute should be used instead */ public function save($product) { parent::save($product); $metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class); $cacheId = __CLASS__ . $product->getData($metadata->getLinkField()) . '_' . $product->getStoreId(); $this->cache->remove($cacheId); $extensionAttributes = $product->getExtensionAttributes(); // this approach is needed for 3rd-party extensions which are not using extension attributes if (empty($extensionAttributes->getConfigurableProductOptions())) { $this->saveConfigurableOptions($product); } if (empty($extensionAttributes->getConfigurableProductLinks())) { $this->saveRelatedProducts($product); } return $this; }
/** * Save the current statuses (enabled/disabled) of cache types to the persistent storage * * @return void */ public function persist() { $this->_options->saveAllOptions($this->_typeStatuses); $this->_cacheFrontend->remove(self::CACHE_ID); }