src/SymbolEnvironment.php
function load() {

		if ($this->cacheConf['type'] == 'noop') {
			return null; // do nothing
		}
		else { // non-noop

			$loadedState = null;

			if ($this->cacheConf['type'] == 'file') {
				$username = \get_current_user();
				$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
				$cachePath = $cacheDir.'/freia.'.(\php_sapi_name() === 'cli' ? 'cli' : 'server').'.'.$username.'.symbols.json';
				if ($this->file_exists($cachePath)) {
					try {
						$loadedState = \json_decode($this->file_get_contents($cachePath), true);
					}
					catch (\Exception $e) {
						$this->error_log('Failed to load cache file: '.$cachePath);
						return null;
					}
				}
				else { // couldn't find cache file
					return null;
				}
			}
			else if ($this->cacheConf['type'] == 'memcached') {
				$mc = $this->memcachedInstance();
				try {
					$loadedState = $mc->get('freia-symbols');
				}
				catch (\Exception $e) {
					$loadedState = null;
				}
			}

			// Process Loaded State
			// ====================

			if ($loadedState == null) {
				return null;
			}

			if ($loadedState['version'] == $this->state['version']) {
				return $loadedState;
			}
			else { // deprecated state
				return null;
			}
		}
	}
function load() {

		if ($this->cacheConf['type'] == 'noop') {
			return null; // do nothing
		}
		else { // non-noop

			$loadedState = null;

			if ($this->cacheConf['type'] == 'file') {
				$username = \get_current_user();
				$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
				$cachePath = $cacheDir.'/freia.'.(\php_sapi_name() === 'cli' ? 'cli' : 'server').'.'.$username.'.symbols.json';
				if ($this->file_exists($cachePath)) {
					try {
						$loadedState = \json_decode($this->file_get_contents($cachePath), true);
					}
					catch (\Exception $e) {
						$this->error_log('Failed to load cache file: '.$cachePath);
						return null;
					}
				}
				else { // couldn't find cache file
					return null;
				}
			}
			else if ($this->cacheConf['type'] == 'memcached') {
				$mc = $this->memcachedInstance();
				try {
					$loadedState = $mc->get('freia-symbols');
				}
				catch (\Exception $e) {
					$loadedState = null;
				}
			}

			// Process Loaded State
			// ====================

			if ($loadedState == null) {
				return null;
			}

			if ($loadedState['version'] == $this->state['version']) {
				return $loadedState;
			}
			else { // deprecated state
				return null;
			}
		}
	}
function load ( ) { if ( $ this -> cacheConf [ 'type' ] == 'noop' ) { return null ; // do nothing } else { // non-noop $ loadedState = null ; if ( $ this -> cacheConf [ 'type' ] == 'file' ) { $ username = \ get_current_user ( ) ; $ cacheDir = realpath ( $ this -> syspath . '/' . \ trim ( $ this -> cacheConf [ 'path' ] , '\\/' ) ) ; $ cachePath = $ cacheDir . '/freia.' . ( \ php_sapi_name ( ) === 'cli' ? 'cli' : 'server' ) . '.' . $ username . '.symbols.json' ; if ( $ this -> file_exists ( $ cachePath ) ) { try { $ loadedState = \ json_decode ( $ this -> file_get_contents ( $ cachePath ) , true ) ; } catch ( \ Exception $ e ) { $ this -> error_log ( 'Failed to load cache file: ' . $ cachePath ) ; return null ; } } else { // couldn't find cache file return null ; } } else if ( $ this -> cacheConf [ 'type' ] == 'memcached' ) { $ mc = $ this -> memcachedInstance ( ) ; try { $ loadedState = $ mc -> get ( 'freia-symbols' ) ; } catch ( \ Exception $ e ) { $ loadedState = null ; } } // Process Loaded State // ==================== if ( $ loadedState == null ) { return null ; } if ( $ loadedState [ 'version' ] == $ this -> state [ 'version' ] ) { return $ loadedState ; } else { // deprecated state return null ; } } }
Load state from persistent store

@return array previously saved state
Load state from persistent store