PMA\libraries\Util::cacheGet PHP Method

cacheGet() public static method

Gets cached information from the session
public static cacheGet ( string $var, Closure $callback = null ) : mixed
$var string variable name
$callback Closure callback to fetch the value
return mixed
    public static function cacheGet($var, $callback = null)
    {
        if (self::cacheExists($var)) {
            return $_SESSION['cache']['server_' . $GLOBALS['server']][$var];
        } else {
            if ($callback) {
                $val = $callback();
                self::cacheSet($var, $val);
                return $val;
            }
            return null;
        }
    }

Usage Example

コード例 #1
0
 /**
  * Checks if this database server is running on Amazon RDS.
  *
  * @return boolean
  */
 public function isAmazonRds()
 {
     if (Util::cacheExists('is_amazon_rds')) {
         return Util::cacheGet('is_amazon_rds');
     }
     $sql = 'SELECT @@basedir';
     $result = $this->fetchResult($sql);
     $rds = $result[0] == '/rdsdbbin/mysql/';
     Util::cacheSet('is_amazon_rds', $rds);
     return $rds;
 }
All Usage Examples Of PMA\libraries\Util::cacheGet
Util