Changeset 10508 for trunk/wp-includes/functions.php
- Timestamp:
- 02/05/2009 08:47:30 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r10507 r10508 623 623 } 624 624 return true; 625 }626 627 /**628 * Delete a transient629 *630 * @since 2.8.0631 * @package WordPress632 * @subpackage Transient633 *634 * @param string $transient Transient name. Expected to not be SQL-escaped635 * @return bool true if successful, false otherwise636 */637 function delete_transient($transient) {638 global $_wp_using_ext_object_cache, $wpdb;639 640 if ( $_wp_using_ext_object_cache ) {641 return wp_cache_delete($transient, 'transient');642 } else {643 $transient = $wpdb->escape($transient);644 return delete_option($transient);645 }646 }647 648 /**649 * Get the value of a transient650 *651 * If the transient does not exist or does not have a value, then the return value652 * will be false.653 *654 * @since 2.8.0655 * @package WordPress656 * @subpackage Transient657 *658 * @param string $transient Transient name. Expected to not be SQL-escaped659 * @return mixed Value of transient660 */661 function get_transient($transient) {662 global $_wp_using_ext_object_cache, $wpdb;663 664 if ( $_wp_using_ext_object_cache ) {665 return wp_cache_get($transient, 'transient');666 } else {667 $transient = $wpdb->escape($transient);668 return get_option($transient);669 }670 }671 672 /**673 * Set/update the value of a transient674 *675 * You do not need to serialize values, if the value needs to be serialize, then676 * it will be serialized before it is set.677 *678 * @since 2.8.0679 * @package WordPress680 * @subpackage Transient681 *682 * @param string $transient Transient name. Expected to not be SQL-escaped683 * @param mixed $value Transient value.684 * @return bool False if value was not set and true if value was set.685 */686 function set_transient($transient, $value) {687 global $_wp_using_ext_object_cache, $wpdb;688 689 if ( $_wp_using_ext_object_cache ) {690 return wp_cache_set($transient, $value, 'transient');691 } else {692 $safe_transient = $wpdb->escape($transient);693 if ( false === get_option( $safe_transient ) )694 return add_option($transient, $value, '', 'no');695 else696 return update_option($transient, $value);697 }698 625 } 699 626
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)