public function get($type, $id)
{
if ($this->_useRedis) {
return (int) $this->redis->hGet($this->_prefix . $type, $id);
} else {
/**
* @var \ManaPHP\Meter\Linear\Model $model
* @var \ManaPHP\Meter\Linear\Model $instance
*/
$model = new $this->_model();
$instance = $model::findFirst(['hash' => md5($type . ':' . $id)]);
return $instance ? (int) $instance->count : 0;
}
}