etsis_Cache_Cookie::cacheHits ()

Counts the number of cache hits and writes it to a file.

Source file: app/src/Core/Cache/etsis_Cache_Cookie.php

View source


Uses


Source

    protected function cacheHits()
    {
        $filename = $this->_dir . 'cache_hits.txt';

        if (!is_readable($filename)) {
            $fp = fopen($filename, 'w');
            fwrite($fp, 0);
            fclose($fp);
            return false;
        }

        $fp = fopen($filename, 'c+');
        flock($fp, LOCK_EX);

        $count = (int) fread($fp, filesize($filename));
        ftruncate($fp, 0);
        fseek($fp, 0);
        fwrite($fp, $count + 1);

        flock($fp, LOCK_UN);
        fclose($fp);
    }


Changelog

  • Since: eduTrac SIS 6.2.0

User Contributed Notes

You must log in before being able to contribute a note.