Saves and returns Manufacturers category article count into cache

@param array  $aCache    Category cache data
@param string $sMnfId    Unique Manufacturer ident
@param string $sActIdent Unique user context ID

@return int
552608
public function setManufacturerArticleCount($aCache, $sMnfId, $sActIdent)
    {
        // if Manufacturer/category name is 'root', skip counting
        if ($sMnfId == 'root') {
            return 0;
        }

        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $sArtTable = $oArticle->getViewName();

        // select each Manufacturer articles count
        //#3485
        $sQ = "select count($sArtTable.oxid) from $sArtTable where $sArtTable.oxparentid = '' and oxmanufacturerid = '$sMnfId' and " . $oArticle->getSqlActiveSnippet();

        $iValue = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getOne($sQ);

        $aCache[$sMnfId][$sActIdent] = (int) $iValue;

        $this->_setManufacturerCache($aCache);

        return $aCache[$sMnfId][$sActIdent];
    }
862012
protected function _getCategoryCacheLifetime(\Cms\Orm\CmsCategoryRecord $category)
    {
        //czas buforowania (na podstawie typu kategorii i pojedynczej kategorii
        $cacheLifetime = (null !== $category->cacheLifetime) ? $category->cacheLifetime : ((null !== $category->getJoined('cms_category_type')->cacheLifetime) ? $category->getJoined('cms_category_type')->cacheLifetime : Orm\CmsCategoryRecord::DEFAULT_CACHE_LIFETIME);
        //jeśli bufor wyłączony (na poziomie typu kategorii, lub pojedynczej kategorii)
        if (0 == $cacheLifetime) {
            //brak bufora
            return 0;
        }
        //iteracja po widgetach
        foreach ($category->getWidgetModel()->getWidgetRelations() as $widgetRelation) {
            //bufor wyłączony przez widget
            if (0 == $widgetCacheLifetime = $widgetRelation->getWidgetRecord()->cacheLifetime) {
                //brak bufora
                return 0;
            }
            //wpływ widgeta na czas buforowania kategorii
            $cacheLifetime = ($cacheLifetime > $widgetCacheLifetime) ? $widgetCacheLifetime : $cacheLifetime;
        }
        //zwrot długości bufora
        return $cacheLifetime;
    }
731741
public function countWithFilter(PaginateFinderConfiguration $configuration, array $siteIds)
    {
        $qa = $this->createQueryWithFilter($configuration, $siteIds);

        return $this->countDocumentAggregateQuery($qa);
    }
638253
protected function cacheViaTrait(string $entryIdentifier, callable $callback, string $cacheIdentifier, int $lifetime = 0, array $tags = [])
    {
        try {
            /** @var AbstractFrontend $cache */
            $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache($cacheIdentifier);
        } catch (\Exception $ex) {
            $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
            $logger->error($ex->getMessage(), ['entryIdentifier' => $entryIdentifier, 'cacheIdentifier' => $cacheIdentifier]);

            return \call_user_func_array($callback, []);
        }

        // Do not use "has" because the cache is a shared resource
        $result = $cache->get($entryIdentifier);
        if (false !== $result) {
            return $result;
        }
        $result = \call_user_func_array($callback, []);
        $cache->set($entryIdentifier, $result, $tags, 0 === $lifetime ? null : $lifetime);

        return $result;
    }
429842
public function getVendorArticleCount($sVendorId)
    {
        // current category unique ident
        $sActIdent = $this->_getUserViewId();

        // loading from cache
        $aVendorData = $this->_getVendorCache();

        if (!$aVendorData || !isset($aVendorData[$sVendorId][$sActIdent])) {
            $iCnt = $this->setVendorArticleCount($aVendorData, $sVendorId, $sActIdent);
        } else {
            $iCnt = $aVendorData[$sVendorId][$sActIdent];
        }

        return $iCnt;
    }
843606
function shopp_category_saved( $category )
	{
		// verify nonce
		if( !isset($_POST['acf_nonce']) || !wp_verify_nonce($_POST['acf_nonce'], 'input') )
		{
			return $category;
		}
		
		
		// $post_id to save against
		$post_id = 'shopp_category_' . $category->id;


		// update the post
		do_action('acf/save_post', $post_id);
		
		
	}
1199561
@Override
	public int countByCommerceWarehouseId(long commerceWarehouseId) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_COMMERCEWAREHOUSEID;

		Object[] finderArgs = new Object[] { commerceWarehouseId };

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE);

			query.append(_FINDER_COLUMN_COMMERCEWAREHOUSEID_COMMERCEWAREHOUSEID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(commerceWarehouseId);

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
237966
public function getEntryMetaData($sMetaType)
    {
        return $this->_getEncoder()->getMetaData($this->getEditObjectId(), $sMetaType, \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(), $this->getEditLang());
    }
786236
public function getSearchArticlesTitle($sSearch, $sCatId, $sVendorId, $sManufacturerId)
    {
        return $this->_prepareFeedName(getStr()->htmlspecialchars($this->_getSearchParamsTranslation('SEARCH_FOR_PRODUCTS_CATEGORY_VENDOR_MANUFACTURER', $sSearch, $sCatId, $sVendorId, $sManufacturerId)));
    }
88019
public function countFeaturedSkills(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collFeaturedSkillsPartial && !$this->isNew();
        if (null === $this->collFeaturedSkills || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collFeaturedSkills) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getFeaturedSkills());
            }

            $query = ChildSkillQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByFeaturedPicture($this)
                ->count($con);
        }

        return count($this->collFeaturedSkills);
    }
494793
static function countWithSubscriberID( $subscriberID, $languageID =false , $enabled = false )
    {
        $cond = array();
        $cond['subscriber_id'] = $subscriberID;
        if ( $enabled !== false )
        {
            $cond['enabled'] = $enabled;
        }
        if ( $languageID !== false )
        {
            $cond['language_id'] = $languageID;
        }
        $count = eZPersistentObject::count( self::definition(), $cond );
        return $count;
    }
773741
protected function _onChangeResetCounts($sOxid, $sVendorId = null, $sManufacturerId = null)
    {
        $myUtilsCount = \OxidEsales\Eshop\Core\Registry::getUtilsCount();

        if ($sVendorId) {
            $myUtilsCount->resetVendorArticleCount($sVendorId);
        }

        if ($sManufacturerId) {
            $myUtilsCount->resetManufacturerArticleCount($sManufacturerId);
        }

        $aCategoryIds = $this->getCategoryIds();
        //also reseting category counts
        foreach ($aCategoryIds as $sCatId) {
            $myUtilsCount->resetCatArticleCount($sCatId);
        }
    }
1041652
public function resetCounter($sCounterType, $sValue = null)
    {
        $blDeleteCacheOnLogout = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blClearCacheOnLogout');

        if (!$blDeleteCacheOnLogout) {
            $myUtilsCount = \OxidEsales\Eshop\Core\Registry::getUtilsCount();
            switch ($sCounterType) {
                case 'priceCatArticle':
                    $myUtilsCount->resetPriceCatArticleCount($sValue);
                    break;
                case 'catArticle':
                    $myUtilsCount->resetCatArticleCount($sValue);
                    break;
                case 'vendorArticle':
                    $myUtilsCount->resetVendorArticleCount($sValue);
                    break;
                case 'manufacturerArticle':
                    $myUtilsCount->resetManufacturerArticleCount($sValue);
                    break;
            }

            $this->_resetContentCache();
        }
    }
345872
function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
		$this->fplock = array();
		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
		$this->cache_lifetime = $cache_lifetime;
	}
91708
public function getIdCompanyBusinessUnitByKey(string $companyBusinessUnitKey): int
    {
        if (isset($this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey])) {
            return $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey];
        }

        $idCompanyBusinessUnit = $this->getFactory()->createCompanyBusinessUnitQuery()
            ->filterByKey($companyBusinessUnitKey)
            ->select(SpyCompanyBusinessUnitTableMap::COL_ID_COMPANY_BUSINESS_UNIT)
            ->findOne();

        if (!$idCompanyBusinessUnit) {
            throw new EntityNotFoundException(sprintf('Could not find company business unit by key "%s"', $companyBusinessUnitKey));
        }

        $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey] = $idCompanyBusinessUnit;

        return $this->idCompanyBusinessUnitListCache[$companyBusinessUnitKey];
    }
583863
protected function cacheCountBetween($count, Carbon $from, Carbon $until, $locale, $cacheKey)
    {
        // Cache only if cacheKey is present
        if ($cacheKey && ($until->timestamp < Carbon::now()->timestamp))
        {
            $key = $this->makeBetweenCacheKey($from, $until, $locale, $cacheKey);

            $this->cache->put($key, $count, 525600);
        }
    }
185207
public function addSites(array $list) : int
    {
        $count = $this->getObjectsCount();
        $nb_customer = $this->getCustomer();

        foreach ($list as $item) {
            if (!($item instanceof CNabuSite) &&
                is_numeric($nb_site_id = nb_getMixedValue($item, NABU_SITE_FIELD_ID))
            ) {
                $nb_site = $nb_customer->getSite($nb_site_id);
                if (!$nb_site instanceof CNabuSite) {
                    throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
                }
            } elseif ($item instanceof CNabuSite) {
                $nb_site = $item;
                if (!$nb_site->validateCustomer($nb_customer)) {
                    throw new ENabuSecurityException(ENabuSecurityException::ERROR_CUSTOMER_NOT_OWNER);
                }
            } else {
                throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
            }

            $nb_site->refresh(true, true);
            $this->nb_site_list->addItem($nb_site);
            $this->nb_language_list->merge($nb_site->getLanguages(true));
            $this->nb_role_list->merge($nb_site->getRoles(true));
        }

        return $this->getObjectsCount() - $count;
    }