LogModel::getOperationCount PHP Method

getOperationCount() public method

A wrapper for GetCountWhere that takes care of caching specific operation counts.
public getOperationCount ( string $Operation ) : integer
$Operation string Comma-delimited list of operation types to get (sum of) counts for.
return integer Returns a count.
    public function getOperationCount($Operation)
    {
        if ($Operation == 'edits') {
            $Operation = ['edit', 'delete'];
        } else {
            $Operation = explode(',', $Operation);
        }
        sort($Operation);
        array_map('ucfirst', $Operation);
        $CacheKey = 'Moderation.LogCount.' . implode('.', $Operation);
        $Count = Gdn::cache()->get($CacheKey);
        if ($Count === Gdn_Cache::CACHEOP_FAILURE) {
            $Count = $this->getCountWhere(['Operation' => $Operation]);
            Gdn::cache()->store($CacheKey, $Count, [Gdn_Cache::FEATURE_EXPIRY => 300]);
        }
        return $Count;
    }