modules/acm_sku/src/Commands/AcmSkuDrushCommands.php
public function flushLinkedSkuCache(array $options = ['sku' => NULL]) {
    // Check if we are asked to clear cache of specific SKU.
    if (!empty($options['sku'])) {
      if ($sku_entity = SKU::loadFromSku($options['sku'])) {
        $this->cacheTagsInvalidator->invalidateTags([
          'acm_sku:linked_skus:' . $sku_entity->id(),
          'acm_sku:' . $sku_entity->id(),
        ]);

        $this->output->writeln(dt('Invalidated linked SKUs cache for @sku.', [
          '@sku' => $options['sku'],
        ]));
      }

      return;
    }

    if (!$this->io()->confirm(dt('Are you sure you want to clear linked SKUs cache for all SKUs?'))) {
      throw new UserAbortException();
    }

    $this->linkedSkuCache->deleteAll();

    $this->output->writeln(dt('Cleared all linked SKUs cache.'));
  }
public function flushLinkedSkuCache(array $options = ['sku' => NULL]) {
    // Check if we are asked to clear cache of specific SKU.
    if (!empty($options['sku'])) {
      if ($sku_entity = SKU::loadFromSku($options['sku'])) {
        $this->cacheTagsInvalidator->invalidateTags([
          'acm_sku:linked_skus:' . $sku_entity->id(),
          'acm_sku:' . $sku_entity->id(),
        ]);

        $this->output->writeln(dt('Invalidated linked SKUs cache for @sku.', [
          '@sku' => $options['sku'],
        ]));
      }

      return;
    }

    if (!$this->io()->confirm(dt('Are you sure you want to clear linked SKUs cache for all SKUs?'))) {
      throw new UserAbortException();
    }

    $this->linkedSkuCache->deleteAll();

    $this->output->writeln(dt('Cleared all linked SKUs cache.'));
  }
public function flushLinkedSkuCache ( array $ options = [ 'sku' => NULL ] ) { // Check if we are asked to clear cache of specific SKU. if ( ! empty ( $ options [ 'sku' ] ) ) { if ( $ sku_entity = SKU :: loadFromSku ( $ options [ 'sku' ] ) ) { $ this -> cacheTagsInvalidator -> invalidateTags ( [ 'acm_sku:linked_skus:' . $ sku_entity -> id ( ) , 'acm_sku:' . $ sku_entity -> id ( ) , ] ) ; $ this -> output -> writeln ( dt ( 'Invalidated linked SKUs cache for @sku.' , [ '@sku' => $ options [ 'sku' ] , ] ) ) ; } return ; } if ( ! $ this -> io ( ) -> confirm ( dt ( 'Are you sure you want to clear linked SKUs cache for all SKUs?' ) ) ) { throw new UserAbortException ( ) ; } $ this -> linkedSkuCache -> deleteAll ( ) ; $ this -> output -> writeln ( dt ( 'Cleared all linked SKUs cache.' ) ) ; }
Clear linked SKUs cache.

@param array $options
Command Options.

@command acm_sku:clear-linked-skus-cache

@option sku SKU to clean linked skus cache of.

@validate-module-enabled acm_sku

@aliases acclsc,clear-linked-skus-cache

@usage drush acclsc
Clear linked SKUs cache for all SKUs.
@usage drush acclsc --skus=SKU
Clear linked SKUs cache for particular SKU.

@throws \Drush\Exceptions\UserAbortException
Clear linked SKUs cache .