zoukankan      html  css  js  c++  java
  • [redis]Redis Transaction

    https://github.com/phpredis/phpredis#transactions

    Transactions

    1. multi, exec, discard - Enter and exit transactional mode
    2. watch, unwatch - Watches a key for modifications by another client.

    multi, exec, discard.


    Description: Enter and exit transactional mode.

    Parameters

    (optional) Redis::MULTI or Redis::PIPELINE. Defaults to Redis::MULTI. A Redis::MULTI block of commands runs as a single transaction; a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity. discard cancels a transaction.

    Return value

    multi() returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until exec() is called.

    Example
    $ret = $redis->multi()
        ->set('key1', 'val1')
        ->get('key1')
        ->set('key2', 'val2')
        ->get('key2')
        ->exec();
    
    /*
    $ret == array(
        0 => TRUE,
        1 => 'val1',
        2 => TRUE,
        3 => 'val2');
    */
  • 相关阅读:
    google搜索的使用小窍门
    openssl的使用
    vi vim 的使用
    nfs
    setfacl命令的使用
    JAVA记录
    Yapi基本使用
    Yapi部署
    Mysql问题记录
    Spring boot+MYSQL多数据源
  • 原文地址:https://www.cnblogs.com/shuman/p/4888029.html
Copyright © 2011-2022 走看看