src/Model.php
protected function castValueForUpdate($value)
    {
        switch ($this->type) {
            case 'string':
                $value = [(string)$value];
                break;
            case 'list':
            case 'set':
                $value = (array)$value;
                break;
            case 'zset':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $v;
                    $casted[] = $k;
                }
                $value = $casted;
                break;
            case 'hash':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $k;
                    $casted[] = $v;
                }
                $value = $casted;
                break;
            default:
                break;
        }

        return $value;
    }
protected function castValueForUpdate($value)
    {
        switch ($this->type) {
            case 'string':
                $value = [(string)$value];
                break;
            case 'list':
            case 'set':
                $value = (array)$value;
                break;
            case 'zset':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $v;
                    $casted[] = $k;
                }
                $value = $casted;
                break;
            case 'hash':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $k;
                    $casted[] = $v;
                }
                $value = $casted;
                break;
            default:
                break;
        }

        return $value;
    }
protected function castValueForUpdate ( $ value ) { switch ( $ this -> type ) { case 'string' : $ value = [ ( string ) $ value ] ; break ; case 'list' : case 'set' : $ value = ( array ) $ value ; break ; case 'zset' : $ casted = [ ] ; foreach ( $ value as $ k => $ v ) { $ casted [ ] = $ v ; $ casted [ ] = $ k ; } $ value = $ casted ; break ; case 'hash' : $ casted = [ ] ; foreach ( $ value as $ k => $ v ) { $ casted [ ] = $ k ; $ casted [ ] = $ v ; } $ value = $ casted ; break ; default : break ; } return $ value ; }
Cast value data type for update according to redis data type

@param $value
@return array
Cast value data type for update according to redis data type