Angejia\Pea\RedisMeta::prefix PHP Метод

prefix() публичный метод

public prefix ( $db, $table, $isForTable = false )
    public function prefix($db, $table, $isForTable = false)
    {
        $version = $this->getSchemaVersion($db, $table);
        if ($isForTable) {
            $version = $version . ':' . $this->getUpdateVersion($db, $table);
        }
        return implode(':', [$this->prefix, $db, $table, $version]);
    }

Usage Example

Пример #1
0
 public function testPrefixForTable()
 {
     $redis = M::mock(Redis::class);
     // schema version
     $redis->shouldReceive('get')->with('2d23e940e190c4fefe3955fe8cf5c8a8')->andReturn(1);
     // update version
     $redis->shouldReceive('get')->with('1031d621441d2f689f95870d86225cf2')->andReturn(6);
     $meta = new RedisMeta($redis);
     $prefix = $meta->prefix('angejia', 'user', true);
     $this->assertEquals('pea:angejia:user:1:6', $prefix);
 }