ManaPHP\Meter\Linear::flush PHP Method

flush() public method

public flush ( string $type, string $id = null ) : void
$type string
$id string
return void
    public function flush($type, $id = null)
    {
        if ($this->_useRedis) {
            if ($id !== null) {
                $count = $this->redis->hGet($this->_prefix . $type, $id);
                if ($count !== '') {
                    $this->_save($type, $id, $count);
                }
            } else {
                $it = null;
                while ($hashes = $this->redis->hScan($this->_prefix . $type, $it, '', 32)) {
                    foreach ($hashes as $hash => $count) {
                        $this->_save($type, $hash, $count);
                    }
                }
            }
        }
    }