### Eclipse Workspace Patch 1.0
#P wordpress-trunk
|
|
|
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** |
| 12 | * global variable storing the object cache class. |
| 13 | * |
| 14 | * is initialized as null and will be set later |
| 15 | * @see wp_cache_init() |
| 16 | * |
| 17 | * @global WP_Object_Cache $GLOBALS['wp_object_cache'] |
| 18 | * @name $wp_object_cache |
| 19 | */ |
| 20 | $GLOBALS['wp_object_cache'] = null; |
| 21 | |
| 22 | /** |
12 | 23 | * Adds data to the cache, if the cache key doesn't aleady exist. |
13 | 24 | * |
14 | 25 | * @since 2.0.0 |
15 | | * @uses $wp_object_cache Object Cache Class |
16 | | * @see WP_Object_Cache::add() |
| 26 | * @global WP_Object_Cache WordPress Object Cache |
17 | 27 | * |
18 | 28 | * @param int|string $key The cache ID to use for retrieval later |
19 | 29 | * @param mixed $data The data to add to the cache store |
… |
… |
|
22 | 32 | * @return unknown |
23 | 33 | */ |
24 | 34 | function wp_cache_add($key, $data, $flag = '', $expire = 0) { |
| 35 | /* @var $wp_object_cache WP_Object_Cache */ |
25 | 36 | global $wp_object_cache; |
26 | 37 | |
27 | 38 | return $wp_object_cache->add($key, $data, $flag, $expire); |
… |
… |
|
47 | 58 | * Removes the cache contents matching ID and flag. |
48 | 59 | * |
49 | 60 | * @since 2.0.0 |
50 | | * @uses $wp_object_cache Object Cache Class |
51 | | * @see WP_Object_Cache::delete() |
| 61 | * @global WP_Object_Cache WordPress Object Cache |
52 | 62 | * |
53 | 63 | * @param int|string $id What the contents in the cache are called |
54 | 64 | * @param string $flag Where the cache contents are grouped |
55 | 65 | * @return bool True on successful removal, false on failure |
56 | 66 | */ |
57 | 67 | function wp_cache_delete($id, $flag = '') { |
| 68 | /* @var $wp_object_cache WP_Object_Cache */ |
58 | 69 | global $wp_object_cache; |
59 | 70 | |
60 | 71 | return $wp_object_cache->delete($id, $flag); |
… |
… |
|
64 | 75 | * Removes all cache items. |
65 | 76 | * |
66 | 77 | * @since 2.0.0 |
67 | | * @uses $wp_object_cache Object Cache Class |
68 | | * @see WP_Object_Cache::flush() |
| 78 | * @global WP_Object_Cache WordPress Object Cache |
69 | 79 | * |
70 | | * @return bool Always returns true |
| 80 | * @return bool true |
71 | 81 | */ |
72 | 82 | function wp_cache_flush() { |
| 83 | /* @var $wp_object_cache WP_Object_Cache */ |
73 | 84 | global $wp_object_cache; |
74 | 85 | |
75 | 86 | return $wp_object_cache->flush(); |
… |
… |
|
79 | 90 | * Retrieves the cache contents from the cache by ID and flag. |
80 | 91 | * |
81 | 92 | * @since 2.0.0 |
82 | | * @uses $wp_object_cache Object Cache Class |
83 | | * @see WP_Object_Cache::get() |
| 93 | * @global WP_Object_Cache WordPress Object Cache |
84 | 94 | * |
85 | 95 | * @param int|string $id What the contents in the cache are called |
86 | 96 | * @param string $flag Where the cache contents are grouped |
87 | 97 | * @return bool|mixed False on failure to retrieve contents or the cache |
88 | 98 | * contents on success |
89 | | */ |
| 99 | */ |
90 | 100 | function wp_cache_get($id, $flag = '') { |
| 101 | /* @var $wp_object_cache WP_Object_Cache */ |
91 | 102 | global $wp_object_cache; |
92 | 103 | |
93 | 104 | return $wp_object_cache->get($id, $flag); |
… |
… |
|
97 | 108 | * Sets up Object Cache Global and assigns it. |
98 | 109 | * |
99 | 110 | * @since 2.0.0 |
100 | | * @global WP_Object_Cache $wp_object_cache WordPress Object Cache |
101 | 111 | */ |
102 | 112 | function wp_cache_init() { |
103 | 113 | $GLOBALS['wp_object_cache'] =& new WP_Object_Cache(); |
… |
… |
|
107 | 117 | * Replaces the contents of the cache with new data. |
108 | 118 | * |
109 | 119 | * @since 2.0.0 |
110 | | * @uses $wp_object_cache Object Cache Class |
111 | | * @see WP_Object_Cache::replace() |
| 120 | * @global WP_Object_Cache WordPress Object Cache |
112 | 121 | * |
113 | 122 | * @param int|string $id What to call the contents in the cache |
114 | 123 | * @param mixed $data The contents to store in the cache |
… |
… |
|
117 | 126 | * @return bool False if cache ID and group already exists, true on success |
118 | 127 | */ |
119 | 128 | function wp_cache_replace($key, $data, $flag = '', $expire = 0) { |
| 129 | /* @var $wp_object_cache WP_Object_Cache */ |
120 | 130 | global $wp_object_cache; |
121 | 131 | |
122 | 132 | return $wp_object_cache->replace($key, $data, $flag, $expire); |
… |
… |
|
126 | 136 | * Saves the data to the cache. |
127 | 137 | * |
128 | 138 | * @since 2.0 |
129 | | * @uses $wp_object_cache Object Cache Class |
130 | | * @see WP_Object_Cache::set() |
| 139 | * @global WP_Object_Cache WordPress Object Cache |
131 | 140 | * |
132 | 141 | * @param int|string $id What to call the contents in the cache |
133 | 142 | * @param mixed $data The contents to store in the cache |
… |
… |
|
136 | 145 | * @return bool False if cache ID and group already exists, true on success |
137 | 146 | */ |
138 | 147 | function wp_cache_set($key, $data, $flag = '', $expire = 0) { |
| 148 | /* @var $wp_object_cache WP_Object_Cache */ |
139 | 149 | global $wp_object_cache; |
140 | 150 | |
141 | 151 | return $wp_object_cache->set($key, $data, $flag, $expire); |
… |
… |
|
279 | 289 | * |
280 | 290 | * @since 2.0.0 |
281 | 291 | * |
282 | | * @return bool Always returns true |
| 292 | * @return bool true |
283 | 293 | */ |
284 | 294 | function flush() { |
285 | 295 | $this->cache = array (); |
… |
… |
|
449 | 459 | return true; |
450 | 460 | } |
451 | 461 | } |
452 | | ?> |
| 462 | |
| 463 | ?> |
| 464 | No newline at end of file |