protected function checkNumberOfAllowedFilters($cacheFile)
    {
        $pathInfo = pathinfo($cacheFile);
        $fileNameHash = preg_replace('%-.*$%', '', $pathInfo['filename']);
        // Grab all the similar files
        $cachedImages = glob($pathInfo['dirname'] . DS . $fileNameHash . '*');

        if (! is_array($cachedImages)) {
            $cachedImages = array();
        }

        // Loop through and remove the ones that are older than the time limit
        foreach ($cachedImages as $k => $image) {
            if (filemtime($image) < time() - $this->options['allowedFiltersTimeLimit']) {
                unset($cachedImages[$k]);
            }
        }

        // Check and see if we've reached the maximum allowed resizes within the current time limit.
        if (count($cachedImages) >= $this->options['numberOfAllowedFilters']) {
            throw new ErrorException('You cannot create anymore resizes/manipulations at this time.');
        }
    }