public function set($key, &$value, $expires=Cache::EXPIRES_NEVER, Dependency $dependency=null) {
        if (!is_string($key))  throw new IllegalTypeException('Illegal type of parameter $key: '.gettype($key));
        if (!is_int($expires)) throw new IllegalTypeException('Illegal type of parameter $expires: '.gettype($expires));

        // data format in the cache: [created, expires, serialized([value, dependency])]
        $fullKey = $this->namespace.'::'.$key;
        $created = time();
        $data    = array($value, $dependency);

        /**
         * PHP 5.3.3/APC 3.1.3
         * -------------------
         * Bug: warning "Potential cache slam averted for key '...'"
         *      - apc_add() and apc_store() return FALSE if called multiple times for the same key
         *
         * @see http://bugs.php.net/bug.php?id=58832
         * @see http://stackoverflow.com/questions/4983370/php-apc-potential-cache-slam-averted-for-key
         *
         * - solution for APC >= 3.1.7: re-introduced setting apc.slam_defense=0
         * - no solution yet for APC 3.1.3-3.1.6
         *
         * @see http://serverfault.com/questions/342295/apc-keeps-crashing
         * @see http://stackoverflow.com/questions/1670034/why-would-apc-store-return-false
         * @see http://notmysock.org/blog/php/user-cache-timebomb.html
         */


        // store value:
        // - If possible use apc_add() which causes less memory fragmentation and minimizes lock waits.
        // - Don't use APC-TTL as the real TTL is checked in self::isCached(). APC-TTL causes various APC bugs.
        if (function_exists('apc_add')) {                                               // APC >= 3.0.13
            if (function_exists('apc_exists')) $isKey =        apc_exists($fullKey);    // APC >= 3.1.4
            else                               $isKey = (bool) apc_fetch ($fullKey);
            if ($isKey)
                apc_delete($fullKey);      // apc_delete()+apc_add() result in less memory fragmentation than apc_store()

            if (!apc_add($fullKey, array($created, $expires, serialize($data)))) {
                //Logger::log('apc_add() unexpectedly returned FALSE for $key "'.$fullKey.'" '.($isKey ? '(did exist and was deleted)':'(did not exist)'), L_WARN);
                return false;
            }
        }
        elseif (!apc_store($fullKey, array($created, $expires, serialize($data)))) {
            //Logger::log('apc_store() unexpectedly returned FALSE for $key "'.$fullKey.'" '.($isKey ? '(did exist and was deleted)':'(did not exist)'), L_WARN);
            return false;
        }

        $this->getReferencePool()->set($key, $value, $expires, $dependency);
        return true;
    }