/** * 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(" REPLACE INTO " . TABLE_PREFIX . "cache SET cacheid = '" . vB::$db->escape_string($cache->getKey()) . "', expires = " . intval($cache->getExpiry()) . ", created = " . TIMENOW . ", locktime = 0, data = \"" . vB::$db->escape_string($data) . "\", serialized = '" . intval($serialized) . "'" ); self::$written[$cache->getKey()] = true; }