src/MemcacheCache.php
public function set($name, $value, $ttl = 0){

		$name = trim($name);

		if($name == ''){

			throw new CacheException('Cache-entry name cannot be empty');
		}

		$name = $this->_prependPrefix($name);

		if(is_resource($value)){

			throw new CacheException('Cannot cache values of type "resource"');
		}

		if(!$this->validateValueSize($value)){

			ExceptionHandler::notice("Value in $name is too big to be stored in memcache.");
		}

		// A 30 day+ TTL is interpreted as a timestamp by memcached

		if($ttl > 2592000){

			$ttl = time() + $ttl;
		}

		// Name cannot be longer than 250 characters

		assert('strlen($name) <= 250');
		if(strlen($name) > 250) return false;

		$result = $this->_Memcache->set($name, $value, 0, $ttl);

		if($result === false && !Memcache::isConnected($this->_Memcache)){

			throw new CacheException("Failed to set '$name', Memcache appears
				to be disconnected!?");
		}

		return $result;
	}
public function set($name, $value, $ttl = 0){

		$name = trim($name);

		if($name == ''){

			throw new CacheException('Cache-entry name cannot be empty');
		}

		$name = $this->_prependPrefix($name);

		if(is_resource($value)){

			throw new CacheException('Cannot cache values of type "resource"');
		}

		if(!$this->validateValueSize($value)){

			ExceptionHandler::notice("Value in $name is too big to be stored in memcache.");
		}

		// A 30 day+ TTL is interpreted as a timestamp by memcached

		if($ttl > 2592000){

			$ttl = time() + $ttl;
		}

		// Name cannot be longer than 250 characters

		assert('strlen($name) <= 250');
		if(strlen($name) > 250) return false;

		$result = $this->_Memcache->set($name, $value, 0, $ttl);

		if($result === false && !Memcache::isConnected($this->_Memcache)){

			throw new CacheException("Failed to set '$name', Memcache appears
				to be disconnected!?");
		}

		return $result;
	}
public function set ( $ name , $ value , $ ttl = 0 ) { $ name = trim ( $ name ) ; if ( $ name == '' ) { throw new CacheException ( 'Cache-entry name cannot be empty' ) ; } $ name = $ this -> _prependPrefix ( $ name ) ; if ( is_resource ( $ value ) ) { throw new CacheException ( 'Cannot cache values of type "resource"' ) ; } if ( ! $ this -> validateValueSize ( $ value ) ) { ExceptionHandler :: notice ( "Value in $name is too big to be stored in memcache." ) ; } // A 30 day+ TTL is interpreted as a timestamp by memcached if ( $ ttl > 2592000 ) { $ ttl = time ( ) + $ ttl ; } // Name cannot be longer than 250 characters assert ( 'strlen($name) <= 250' ) ; if ( strlen ( $ name ) > 250 ) return false ; $ result = $ this -> _Memcache -> set ( $ name , $ value , 0 , $ ttl ) ; if ( $ result === false && ! Memcache :: isConnected ( $ this -> _Memcache ) ) { throw new CacheException ( "Failed to set '$name', Memcache appears
				to be disconnected!?" ) ; } return $ result ; }
Add an entry to the MemcacheCache.

@param string $name
@param mixed $value
@param integer $ttl
@return boolean
@throws CacheException
Add an entry to the MemcacheCache .