Predis\Response\Status::get PHP 메소드

get() 공개 정적인 메소드

Common status responses such as OK or QUEUED are cached in order to lower the global memory usage especially when using pipelines.
public static get ( string $payload ) : string
$payload string Status response payload.
리턴 string
    public static function get($payload)
    {
        switch ($payload) {
            case 'OK':
            case 'QUEUED':
                if (isset(self::${$payload})) {
                    return self::${$payload};
                }
                return self::${$payload} = new self($payload);
            default:
                return new self($payload);
        }
    }

Usage Example

예제 #1
0
 /**
  * @group disconnected
  */
 public function testStaticGetMethodCachesOnlyCommonStatuses()
 {
     $response = Status::get('OK');
     $this->assertSame($response, Status::get('OK'));
     $response = Status::get('QUEUED');
     $this->assertSame($response, Status::get('QUEUED'));
     $response = Status::get('PONG');
     $this->assertNotSame($response, Status::get('PONG'));
 }
All Usage Examples Of Predis\Response\Status::get