• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • TokyoTyrant::putCat()

    (PECL tokyo_tyrant >= 0.1.0)

    Concatenates to a record

    说明

    publicTokyoTyrant::putCat(mixed $keys[,string $value]): TokyoTyrant

    Appends a value into existing key or multiple values if$keysis an array. The second parameter is mandatory if$keysis a string. If the record does not exist a new record is created.

    参数

    $keys

    A string key or an array of key-value pairs

    $value

    The value in case a string key is used

    返回值

    This method returns a reference to the current object and throws TokyoTyrantException on failure.

    范例

    Example #1 TokyoTyrant::putCat() example

    <?php
    /* Connect to a database on default port */
    $tt = new TokyoTyrant("localhost");
    /* Create a new key */
    $tt->put("key", "value");
    /* Concatenate single key-value pair */
    $tt->putCat("key", " has more data");
    /* Echo the key */
    echo $tt->get("key");
    ?>
    

    以上例程会输出:

    value has more data
    

    参见

    • TokyoTyrant::put() Puts values
    • TokyoTyrant::putKeep() Puts a record