Exemple #1
0
 public static function flush($driver = NULL)
 {
     if (!($engine = CacheFactory::getInstance($driver))) {
         return false;
     }
     return $engine->flush();
 }
Exemple #2
0
 protected static function processRoute($route, $restrict)
 {
     $original_route = $route;
     $cache = CacheFactory::getInstance();
     /** Read route information from cache if possible */
     if ($cacheRoute = $cache->get('route_rewrite_' . md5($route))) {
         return $cacheRoute;
     }
     $restrictions = array('int' => '(?<$1>[0-9]+)', 'float' => '(?<$1>[0-9\\.]+)', 'alpha' => '(?<$1>[a-zA-Z]+)', 'alphanum' => '(?<$1>[a-zA-Z0-9]+)');
     $route = str_replace(')', ')?', str_replace('(', '(?:', $route));
     foreach ($restrict as $variable => $restriction) {
         $route = preg_replace("`:({$variable})`", $restrictions[$restriction], $route);
     }
     $route = preg_replace('`:([a-zA-Z][a-zA-Z0-9]*)`', '(?<$1>[^/]+)', $route);
     $cache->set('route_rewrite_' . md5($original_route), $route, 0);
     return $route;
 }
Exemple #3
0
 public function cache()
 {
     if (!$this->cacheable) {
         return false;
     }
     $cache = CacheFactory::getInstance();
     $cache->set('models_' . static::$table_name . '_' . $this->values[static::$column_map[static::$primary_key]], $this, $this->cache_expire);
 }