예제 #1
0
 public static function getCacheObject($appCacheType)
 {
     switch ($appCacheType) {
         /*case 'memcache': 
               $this -> cache = new MemcacheAppCache();
           break;*/
         case 'redis':
             self::$cache = new RedisAppCache();
             break;
         default:
             self::$cache = new RedisAppCache();
             break;
     }
     return self::$cache;
 }
예제 #2
0
 public static function setup()
 {
     /* Setting up the app-configurations globally for use across classes */
     global $configs;
     $configs = json_decode(file_get_contents('collap-configs.json'), true);
     /* Setting up the logger globally for use across classes */
     global $logger;
     $logger = new ShopbookLogger();
     $logger->enabled = true;
     $logger->debug("Setting up ...");
     /* Setting up the cache object globally for use across classes */
     global $cache;
     $cache = AppCacheRegistry::getCacheObject('redis');
     /* Setting up the warnings payload as a global variable to be able 
     			to dump warnings along the API flow */
     global $warnings_payload;
     /* Logging API stats */
     $memoryUsage = memory_get_usage(true) / (1024 * 1024);
     $cpuLoad = Util::ServerLoad();
     self::$pageTimer = new Timer('page_timer');
     self::$pageTimer->start();
     $logger->debug("Init Memory: {$memoryUsage} MB; Init CPU: {$cpuLoad}%");
 }