Phalcon\Translate\Adapter\Redis::set PHP Method

set() public method

Sets (insert or updates) a translation for given key
public set ( string $translateKey, string $message ) : boolean
$translateKey string
$message string
return boolean
    public function set($translateKey, $message)
    {
        return $this->exists($translateKey) ? $this->update($translateKey, $message) : $this->add($translateKey, $message);
    }

Usage Example

Example #1
0
 /**
  * Adds a translation for given key (No existence check!)
  *
  * @param  string  $translateKey
  * @param  string  $message
  * @return boolean
  */
 public function add($translateKey, $message)
 {
     $index = $this->getLongKey($translateKey);
     $key = $this->getShortKey($index);
     $this->loadValueByKey($key);
     if (!isset($this->cache[$key])) {
         $this->cache[$key] = [];
     }
     $this->cache[$key][$index] = $message;
     return $this->redis->set($key, serialize($this->cache[$key]));
 }