Example #1
0
	public static function addValidate(PermissionKey $pk, $valid) {
		$cl = CacheLocal::get();
		if ($cl->enabled) {
			$object = $pk->getPermissionObject();
			if (is_object($object)) {
				$identifier = 'pk:' . $pk->getPermissionKeyHandle() . ':' . $object->getPermissionObjectIdentifier();
			} else {
				$identifier = 'pk:' . $pk->getPermissionKeyHandle();
			}
			$cl->cache[$identifier] = $valid;
		}
	}
Example #2
0
 public static function set($type, $id, $object)
 {
     $loc = CacheLocal::get();
     if (!$loc->enabled) {
         return false;
     }
     $key = Cache::key($type, $id);
     if (is_object($object)) {
         $r = clone $object;
     } else {
         $r = $object;
     }
     $loc->cache[$key] = $r;
 }
Example #3
0
	/** 
	 * Gets the array of items that have been set using set()
	 * @return array
	 */
	public function getSets() { 
		$loc = CacheLocal::get();
		if (isset($loc->cache['controllerSets'])) {
			return $loc->cache['controllerSets'];
		}
		return array();
	}
Example #4
0
	/** 
	 * Completely flushes the cache
	 */	
	public function flush() {
		$cache = Cache::getLibrary();
		
		$loc = CacheLocal::get();
		$loc->cache = array();
		if (!$cache) {
			return false;
		}
		$cache->setOption('caching', true);
		$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
		if (!ENABLE_CACHE) {
			Cache::disableCache();
		}		
		return true;
	}
Example #5
0
 /** 
  * Completely flushes the cache
  */
 public function flush()
 {
     $db = Loader::db();
     $r = $db->MetaTables();
     // flush the CSS cache
     if (is_dir(DIR_FILES_CACHE . '/' . DIRNAME_CSS)) {
         $fh = Loader::helper("file");
         $fh->removeAll(DIR_FILES_CACHE . '/' . DIRNAME_CSS);
     }
     $pageCache = PageCache::getLibrary();
     if (is_object($pageCache)) {
         $pageCache->flush();
     }
     if (in_array('Config', $r)) {
         // clear the environment overrides cache
         $env = Environment::get();
         $env->clearOverrideCache();
         if (in_array('btCachedBlockRecord', $db->MetaColumnNames('Blocks'))) {
             $db->Execute('update Blocks set btCachedBlockRecord = null');
         }
         if (in_array('CollectionVersionBlocksOutputCache', $r)) {
             $db->Execute('truncate table CollectionVersionBlocksOutputCache');
         }
     }
     $loc = CacheLocal::get();
     $loc->cache = array();
     $cache = Cache::getLibrary();
     if ($cache) {
         $cache->setOption('caching', true);
         $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     }
     if (function_exists('apc_clear_cache')) {
         apc_clear_cache();
     }
     Events::fire('on_cache_flush', $cache);
     return true;
 }
Example #6
0
	/** 
	 * Removes an item from the cache
	 */	
	public function delete($type, $id){
		$cache = Cache::getLibrary();
		if ($cache) {
			$cache->remove(Cache::key($type, $id));
		}

		$loc = CacheLocal::get();
		if ($loc->enabled && isset($loc->cache[Cache::key($type, $id)])) {
			unset($loc->cache[Cache::key($type, $id)]);
		}
	}
Example #7
0
 public static function getAccessObject($pk, $object)
 {
     if (!PermissionCache::$enabled) {
         return false;
     }
     $cl = CacheLocal::get();
     if ($cl->enabled) {
         $identifier = 'pka:' . $pk->getPermissionKeyHandle() . ':' . $object->getPermissionObjectIdentifier();
         if (array_key_exists($identifier, $cl->cache)) {
             return $cl->cache[$identifier];
         }
     }
     return false;
 }