/** * Writes the cache data to storage. * * @param vB_CacheObject $cache */ protected function writeCache(vB_CacheObject $cache) { // Check if we have already written this cache entry for this request $key = $cache->getKey(); if (!empty($key) and isset(self::$written[$key])) { return; } $data = $cache->getData(); if (is_array($data) or is_object($data)) { $serialized = '1'; $data = serialize($data); } else { $serialized = '0'; } vB::$db->query_write("\r\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "cache\r\n\t\t\tSET cacheid = '" . vB::$db->escape_string($cache->getKey()) . "',\r\n\t\t\t\texpires = " . intval($cache->getExpiry()) . ",\r\n\t\t\t\tcreated = " . TIMENOW . ",\r\n\t\t\t\tlocktime = 0,\r\n\t\t\t\tdata = \"" . vB::$db->escape_string($data) . "\",\r\n\t\t\t\tserialized = '" . intval($serialized) . "'"); self::$written[$cache->getKey()] = true; }