value set<br>
The string can't be longer than 1073741824 bytes (1 GB).

@param key
@param value
@param expiration

@return false if redis did not execute the option
196504
public boolean set(String key, Object value, Integer expiration) throws Exception {
        String result = "";
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();

            long begin = System.currentTimeMillis();
            if (expiration > 0) {
                result = jedis.setex(SafeEncoder.encode(key), expiration, serialize(value));
            } else {
                result = jedis.set(SafeEncoder.encode(key), serialize(value));
            }
            long end = System.currentTimeMillis();
            logger.info("set key:" + key + ", spends: " + (end - begin) + "ms");
            return "OK".equalsIgnoreCase(result);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            this.jedisPool.returnBrokenResource(jedis);
            throw e;
        } finally {
            if (jedis != null) {
                this.jedisPool.returnResource(jedis);
            }
        }

    }
1253758
static boolean isCOctetStringValid(String value, int maxLength) {
        if (value == null)
            return true;
        if (value.length() >= maxLength)
            return false;
        return true;

    }
83498
public function decrement($key, $value = 1, $expiration = 0)
    {
        $new = intval($this->get($key));
        $new -= $value;
        $this->set($key, $new, $expiration);
    }
1168384
private function storeValueInCache($key, $value, $expiration = null)
    {
        $this->cache[$key] = new MemcacheObject($key, serialize($value), $this->normalizeExpirationTime($expiration));
    }
361083
public Long expire(Object key, int seconds) {
		Jedis jedis = getJedis();
		try {
			return jedis.expire(keyToBytes(key), seconds);
		}
		finally {close(jedis);}
	}
628150
public function store($key, $value = null, $expiration = 0)
    {
        return $this->set($key, $value, ($expiration ? $expiration : null));
    }
181458
@Override
  public String set(final byte[] key, final byte[] value) {
    checkIsInMultiOrPipeline();
    client.set(key, value);
    return client.getStatusCodeReply();
  }
290719
function delExpiry(key, req) {
  var rval = this.getRawKey(key);
  if(rval === undefined || rval.e === undefined) return 0;
  // the code flow ensures we have a valid
  // index into the expiring keys array
  this._ekeys.splice(ArrayIndex.indexOf(key, this._ekeys), 1);
  delete this._expires[key];
  delete rval.e;
  return 1;
}
689596
@SuppressWarnings("unchecked")
	public <T> T getSet(Object key, Object value) {
		Jedis jedis = getJedis();
		try {
			return (T)valueFromBytes(jedis.getSet(keyToBytes(key), valueToBytes(value)));
		}
		finally {close(jedis);}
	}
502879
public boolean add(String key, Object value, Integer expiration) throws Exception {
        Jedis jedis = null;

        try {

            jedis = this.jedisPool.getResource();
            long begin = System.currentTimeMillis();
            // 操作setnx与expire成功返回1，失败返回0，仅当均返回1时，实际操作成功
            Long result = jedis.setnx(SafeEncoder.encode(key), serialize(value));
            if (expiration > 0) {
                result = result & jedis.expire(key, expiration);
            }
            long end = System.currentTimeMillis();
            if (result == 1L) {
                logger.info("add key:" + key + ", spends: " + (end - begin) + "ms");
            } else {
                logger.info("add key: " + key + " failed, key has already exists! ");
            }

            return result == 1L;
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            this.jedisPool.returnBrokenResource(jedis);
            throw e;
        } finally {
            if (jedis != null) {
                this.jedisPool.returnResource(jedis);
            }
        }
    }
817435
public V put(K key, V value)
  {
    Entry<V> oldValue = _cache.put(key, new Entry<V>(_expireInterval, value));

    if (oldValue != null)
      return oldValue.getValue();
    else
      return null;
  }
1057436
public function set($key, $value, $expiration = 0)
    {
        $file = $this->cacheDir . $this->getDir($key) . $this->getFile($key);

        if (!file_exists(dirname($file))) {
            mkdir(dirname($file), 0755, true);
        }

        $return = file_put_contents($file, $value);
        touch($file, time() + $expiration);

        return $return;
    }
918626
public function set(string $key, $value = null, int $expiration = 0) : bool
    {
        if (apcu_store($key, $value, $expiration)) {
            $this->updateMetaData($key, $expiration);
            $this->saveCacheListing();

            return true;
        }

        return false;
    }
452005
void expireAfterWrite(String key, @Nullable String value) {
    requireArgument(expireAfterWriteDuration == UNSET_INT, "expireAfterWrite was already set");
    expireAfterWriteDuration = parseDuration(key, value);
    expireAfterWriteTimeUnit = parseTimeUnit(key, value);
  }
557557
public byte[] set(byte[] key,byte[] value){
		Jedis jedis = jedisPool.getResource();
		try{
			jedis.set(key,value);
			if(this.expire != 0){
				jedis.expire(key, this.expire);
		 	}
		}finally{
			jedisPool.returnResource(jedis);
		}
		return value;
	}
374508
public function set($key, $value = null, $expiration = 0)
    {
        if (apc_store($key, $value, ($expiration ? $expiration : null))) {
            $expiration = (empty ($expiration)) ? 0 : $expiration;

            // Prepare Listing
            $newListing = array(
                'key'        => ( string )$key,
                'expiration' => ( int )$expiration,
                'updated'    => ( string )date('Y-m-d H:i:s')
            );

            if (isset ($this->cacheListing [$key])) {
                $this->cacheListing [$key] = array_merge($this->cacheListing [$key], $newListing);
            } else {
                $newListing ['created']    = $newListing ['updated'];
                $this->cacheListing [$key] = $newListing;
            }

            $this->saveCacheListing();

            return true;
        }

        return false;
    }
1215778
public static function set(string $key, $value, int $expire = null): bool
    {
        return self::storage()->set($key, $value, $expire);
    }