wp_cache_set

Saves the data to the cache.

Description

wp_cache_set( (int|string) $key, (mixed) $data, (string) $flag = '', (int) $expire = 0 ); 

Parameters (4)

0. $key (int|string)
What to call the contents in the cache
1. $data (mixed)
The contents to store in the cache
2. $flag — Optional. (string) => ''
Where to group the cache contents
3. $expire — Optional. (int)
When to expire the cache contents

Usage

  1. if ( !function_exists( 'wp_cache_set' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-object-cache.php'; 
  3.  
  4. // What to call the contents in the cache 
  5. $key = null; 
  6.  
  7. // The contents to store in the cache 
  8. $data = null; 
  9.  
  10. // Where to group the cache contents 
  11. $flag = ''; 
  12.  
  13. // When to expire the cache contents 
  14. $expire = -1; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wp_cache_set($key, $data, $flag, $expire); 
  18.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/backpress/functions.wp-object-cache.php  
  1. function wp_cache_set($key, $data, $flag = '', $expire = 0) { 
  2. global $wp_object_cache; 
  3.  
  4. return $wp_object_cache->set($key, $data, $flag, $expire);