SimplePie_Cache

Used to create cache objects.

Defined (1)

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

/wp-includes/SimplePie/Cache.php  
  1. class SimplePie_Cache 
  2. /** 
  3. * Cache handler classes 
  4. * These receive 3 parameters to their constructor, as documented in 
  5. * {@see register()} 
  6. * @var array 
  7. */ 
  8. protected static $handlers = array( 
  9. 'mysql' => 'SimplePie_Cache_MySQL',  
  10. 'memcache' => 'SimplePie_Cache_Memcache',  
  11. ); 
  12.  
  13. /** 
  14. * Don't call the constructor. Please. 
  15. */ 
  16. private function __construct() { } 
  17.  
  18. /** 
  19. * Create a new SimplePie_Cache object 
  20. * @param string $location URL location (scheme is used to determine handler) 
  21. * @param string $filename Unique identifier for cache object 
  22. * @param string $extension 'spi' or 'spc' 
  23. * @return SimplePie_Cache_Base Type of object depends on scheme of `$location` 
  24. */ 
  25. public static function get_handler($location, $filename, $extension) 
  26. $type = explode(':', $location, 2); 
  27. $type = $type[0]; 
  28. if (!empty(self::$handlers[$type])) 
  29. $class = self::$handlers[$type]; 
  30. return new $class($location, $filename, $extension); 
  31.  
  32. return new SimplePie_Cache_File($location, $filename, $extension); 
  33.  
  34. /** 
  35. * Create a new SimplePie_Cache object 
  36. * @deprecated Use {@see get_handler} instead 
  37. */ 
  38. public function create($location, $filename, $extension) 
  39. trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED); 
  40. return self::get_handler($location, $filename, $extension); 
  41.  
  42. /** 
  43. * Register a handler 
  44. * @param string $type DSN type to register for 
  45. * @param string $class Name of handler class. Must implement SimplePie_Cache_Base 
  46. */ 
  47. public static function register($type, $class) 
  48. self::$handlers[$type] = $class; 
  49.  
  50. /** 
  51. * Parse a URL into an array 
  52. * @param string $url 
  53. * @return array 
  54. */ 
  55. public static function parse_URL($url) 
  56. $params = parse_url($url); 
  57. $params['extras'] = array(); 
  58. if (isset($params['query'])) 
  59. parse_str($params['query'], $params['extras']); 
  60. return $params;