Habari\Cache::has PHP Method

has() public static method

Is record with $name in the cache?
public static has ( mixed $name ) : boolean
$name mixed name of the cached item or an array of array( string $group, string $name )
return boolean true if item is cached, false if not
    public static function has($name)
    {
        if (is_array($name)) {
            $array = $name;
            list($group, $name) = $array;
        } else {
            $group = self::$default_group;
        }
        $group = self::site_unique() . $group;
        return self::$instance->_has($name, $group);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Handle incoming requests for the introspection document
  */
 public function act_introspection()
 {
     Utils::check_request_method(array('GET', 'HEAD', 'POST'));
     $cache_xml = null;
     if (Cache::has('atom:introspection:xml')) {
         $cache_xml = Cache::get('atom:introspection:xml');
         $cache_xml = simplexml_load_string($cache_xml);
     }
     if ($cache_xml instanceof SimpleXMLElement) {
         $xml = $cache_xml;
     } else {
         $xml = new SimpleXMLElement('<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"></service>');
         $service_workspace = $xml->addChild('workspace');
         $workspace_title = $service_workspace->addChild('atom:title', Utils::htmlspecialchars(Options::get('title')), 'http://www.w3.org/2005/Atom');
         $workspace_collection = $service_workspace->addChild('collection');
         $workspace_collection->addAttribute('href', URL::get('atom_feed', 'index=1'));
         $collection_title = $workspace_collection->addChild('atom:title', 'Blog Entries', 'http://www.w3.org/2005/Atom');
         $collection_accept = $workspace_collection->addChild('accept', 'application/atom+xml;type=entry');
         Cache::set('atom:introspection:xml', $xml->asXML());
     }
     Plugins::act('atom_introspection', $xml, $this->handler_vars);
     $xml = $xml->asXML();
     ob_clean();
     header('Content-Type: application/atomsvc+xml');
     print $xml;
 }
All Usage Examples Of Habari\Cache::has