Changeset 1187
- Timestamp:
- 01/15/08 11:56:58 (11 months ago)
- Files:
-
- trunk/wp-includes/cache.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/cache.php
r1125 r1187 140 140 141 141 function get($id, $group = 'default', $count_hits = true) { 142 $hash = $this->key($id, $group); 142 if (empty ($group)) 143 $group = 'default'; 144 143 145 $group_key = $this->key( '', $group ); 144 if (empty ($group)) 145 $group = 'default'; 146 $hash = $this->key($id, $group_key); 146 147 147 148 if (isset ($this->cache[$hash])) { … … 169 170 } 170 171 171 $cache_file = $this->cache_dir.$this->get_group_dir($group_key)."/".$this->hash($ id).'.php';172 $cache_file = $this->cache_dir.$this->get_group_dir($group_key)."/".$this->hash($hash).'.php'; 172 173 if (!file_exists($cache_file)) { 173 174 $this->non_existant_objects[$hash] = true; … … 286 287 287 288 function set($id, $data, $group = 'default', $expire = '') { 288 $hash = $this->key($id, $group); 289 $group_key = $this->key( '', $group ); 290 $hash = $this->key($id, $group_key); 289 291 if (empty ($group)) 290 292 $group = 'default'; … … 295 297 $this->cache[$hash] = $data; 296 298 unset ($this->non_existant_objects[$hash]); 297 $this->dirty_objects[$ this->key( '', $group )][] = $id;299 $this->dirty_objects[$group_key][] = $id; 298 300 299 301 return true; … … 339 341 $ids = array_unique($ids); 340 342 foreach ($ids as $id) { 341 $cache_file = $group_dir.$this->hash($group.'-'.$id).'.php'; 343 $hash = $this->key($id, $group); 344 $cache_file = $group_dir.$this->hash($hash).'.php'; 342 345 343 346 // Remove the cache file if the key is not set. 344 if (!isset ($this->cache[$ group.'-'.$id])) {347 if (!isset ($this->cache[$hash])) { 345 348 if (file_exists($cache_file)) 346 349 @ unlink($cache_file); … … 349 352 350 353 $temp_file = tempnam($group_dir, 'tmp'); 351 $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$ group.'-'.$id])).CACHE_SERIAL_FOOTER;354 $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$hash])).CACHE_SERIAL_FOOTER; 352 355 $fd = @fopen($temp_file, 'w'); 353 356 if ( false === $fd ) {
