/**
  * Returns a CacheProvider based on the given $cacheConfig
  * @param WURFL_Configuration_Config $cacheConfig 
  * @return WURFL_Cache_CacheProvider
  */
 public static function getCacheProvider($cacheConfig = null)
 {
     $cacheConfig = is_null($cacheConfig) ? WURFL_Configuration_ConfigHolder::getWURFLConfig()->cache : $cacheConfig;
     $provider = isset($cacheConfig["provider"]) ? $cacheConfig["provider"] : NULL;
     $cache = isset($cacheConfig["params"]) ? $cacheConfig["params"] : NULL;
     switch ($provider) {
         case WURFL_Constants::FILE:
             self::$_cacheProvider = new WURFL_Cache_FileCacheProvider($cache);
             break;
         case WURFL_Constants::MEMCACHE:
             self::$_cacheProvider = new WURFL_Cache_MemcacheCacheProvider($cache);
             break;
         case WURFL_Constants::APC:
             self::$_cacheProvider = new WURFL_Cache_APCCacheProvider($cache);
             break;
         case WURFL_Constants::EACCELERATOR:
             self::$_cacheProvider = new WURFL_Cache_EAcceleratorCacheProvider($cache);
             break;
         case WURFL_Constants::MYSQL:
             self::$_cacheProvider = new WURFL_Cache_MysqlCacheProvider($cache);
             break;
         default:
             self::$_cacheProvider = new WURFL_Cache_NullCacheProvider();
             break;
     }
     return self::$_cacheProvider;
 }
Exemplo n.º 2
0
 /**
  * Returns A CacheProvider
  *
  * @return CacheProvider
  */
 public static function getCacheProvider()
 {
     $cache = WURFL_Configuration_ConfigHolder::getWURFLConfig()->cache;
     $provider = $cache["provider"];
     switch ($provider) {
         case WURFL_Constants::FILE:
             self::$_cacheProvider = new WURFL_Cache_FileCacheProvider($cache);
             break;
         case WURFL_Constants::MEMCACHE:
             self::$_cacheProvider = new WURFL_Cache_MemcacheCacheProvider($cache);
             break;
         case WURFL_Constants::APC:
             self::$_cacheProvider = new WURFL_Cache_APCCacheProvider($cache);
             break;
         case WURFL_Constants::EACCELERATOR:
             self::$_cacheProvider = new WURFL_Cache_EAcceleratorCacheProvider($cache);
             break;
         case WURFL_Constants::MYSQL:
             self::$_cacheProvider = new WURFL_Cache_MysqlCacheProvider($cache);
             break;
         default:
             self::$_cacheProvider = new WURFL_Cache_NullCacheProvider();
             break;
     }
     return self::$_cacheProvider;
 }
Exemplo n.º 3
0
 public function reload($wurflConfigurationPath)
 {
     $wurflConfig = WURFL_Configuration_ConfigFactory::create($wurflConfigurationPath);
     WURFL_Configuration_ConfigHolder::setWURFLConfig($wurflConfig);
     $cacheProvider = WURFL_Cache_CacheProviderFactory::getCacheProvider();
     $cacheProvider->clear();
     $persistenceProvider = WURFL_Xml_PersistenceProvider_PersistenceProviderManager::getPersistenceProvider();
     $persistenceProvider->setWURFLLoaded(FALSE);
     WURFL_WURFLManagerProvider::getWURFLManager($wurflConfigurationPath);
 }
Exemplo n.º 4
0
 /**
  * Initiaizes the actual WURFLManager
  *
  * @param string $configurationFilePath Absolute path to the wurfl configuration file
  */
 private static function _init($configurationFilePath)
 {
     $wurflConfig = WURFL_Configuration_ConfigFactory::create($configurationFilePath);
     WURFL_Configuration_ConfigHolder::setWURFLConfig($wurflConfig);
     $wurflFileParser = new WURFL_Xml_WURFLFileParser();
     $wurflPatchFileParser = new WURFL_Xml_WURFLPatchFileParser();
     $wurflPatchManager = new WURFL_Xml_PatchManager();
     // Persistence and Cache Providers
     $persistenceProvider = WURFL_Xml_PersistenceProvider_PersistenceProviderManager::getPersistenceProvider();
     $cacheProvider = WURFL_Cache_CacheProviderFactory::getCacheProvider();
     $xmlResourceManager = new WURFL_Xml_XMLResourceManager($persistenceProvider, $wurflPatchManager, $wurflFileParser, $wurflPatchFileParser);
     $userAgentHandlerChain = WURFL_UserAgentHandlerChainFactory::create();
     $deviceRepository = new WURFL_DeviceRepository($xmlResourceManager, $userAgentHandlerChain, $persistenceProvider);
     $wurflService = new WURFL_WURFLService($deviceRepository, $userAgentHandlerChain, $cacheProvider);
     $userAgentNormalizer = new WURFL_Request_UserAgentNormalizer();
     $requestFactory = new WURFL_Request_GenericRequestFactory($userAgentNormalizer);
     self::$wurflManager = new WURFL_WURFLManager($wurflService, $requestFactory);
 }
	private static function cacheProvider($cacheConfig) {
		return WURFL_Cache_CacheProviderFactory::getCacheProvider ( $cacheConfig );
	}