Builds cache engine

@param \PDO $pdo
@param string $table Table name
@return \Krystal\Cache\Sql\SqlCacheEngine
544078
public static function build($pdo, $table)
    {
        $mapper = new CacheMapper(new NativeSerializer(), $pdo, $table);
        return new SqlCacheEngine($mapper);
    }
1218652
public function pdo(\PDO $pdo = NULL)
	{
		if ($pdo !== NULL)
		{
			$this->_pdo = $pdo;
			return $this;
		}
		return $this->_pdo;
	}
1355484
public static <K, V> Cache<K, V> createCache(String sqlCacheClass, String prefix, Properties properties) {
        if (StringUtil.isEmpty(sqlCacheClass)) {
            try {
                Class.forName("com.google.common.cache.Cache");
                return new GuavaCache<K, V>(properties, prefix);
            } catch (Throwable t) {
                return new SimpleCache<K, V>(properties, prefix);
            }
        } else {
            try {
                Class<? extends Cache> clazz = (Class<? extends Cache>) Class.forName(sqlCacheClass);
                try {
                    Constructor<? extends Cache> constructor = clazz.getConstructor(Properties.class, String.class);
                    return constructor.newInstance(properties, prefix);
                } catch (Exception e) {
                    return clazz.newInstance();
                }
            } catch (Throwable t) {
                throw new PageException("Created Sql Cache [" + sqlCacheClass + "] Error", t);
            }
        }
    }
473951
protected function getKeys($table,$table2=null) {
		$pdo = $this->adapter->getDatabase()->getPDO();
		$keys = $pdo->cubrid_schema(PDO::CUBRID_SCH_EXPORTED_KEYS,$table);//print_r($keys);
		if ($table2) $keys = array_merge($keys, $pdo->cubrid_schema(PDO::CUBRID_SCH_IMPORTED_KEYS,$table2) );//print_r($keys);
		
		return $keys;
	}
1138163
private function getPdo()
    {
        static $pdo = null;

        if (is_null($pdo)) {
            $builder = new InstanceBuilder();
            $pdo = $builder->build('PDO', $this->args);
        }

        return $pdo;
    }
577428
protected function getPDO()
    {
        if (null === $this->pdo) {
            $this->pdo = new \PDO($this->dsn, $this->user, $this->password, $this->options);
        }
        return $this->pdo;
    }
1238258
public static function table( $table, $connection = null )
	{
		return self::getInstance()->getConnection($connection)->table($table);
	}
270629
public function initConnection(Connection $connection)
    {
        /** @var $pdo PDO */
        $pdo = $connection->getWrappedConnection();
        $this->fkSupported = version_compare('3.6.19', $pdo->getAttribute(PDO::ATTR_SERVER_VERSION)) < 0;
        $pdo->exec($this->buildEnableForeignKeysQuery());
    }
639271
static public function get($table)
    {
        // Checks if object model exist
        if (array_key_exists($table, self::$models)) {

            // Returns the existing model object
            return self::$models[$table];
        }
        // Assembling the class name with the appropriate namespace
        $class = 'App\Model\\' . ucfirst($table) . 'Model';

        // Creates the pdo connection
        $pdo = PDOFactory::getConnection();

        // Creates the database object
        $database = new PDODatabase($pdo);

        // Creates the model object
        $model = new $class($database);

        // Saves the model object
        self::$models[$table] = $model;

        // Returns the model object
        return $model;
    }
889837
public function getPdo()
    {
        if (!$this->pdo) {
            $this->connect();
        }

        $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
        $this->pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);

        return $this->pdo;
    }
1192069
public static function getPDO($dsn, $username, $password, $settings = ['attributes' => []])
    {
        // if not set self pdo object property or pdo set as null
        if (!isset(self::$PDO) || (self::$PDO !== null)) {
            self::$PDO = new self($dsn, $username, $password, $settings); // set class pdo property with new connection
        }

        // return class property object
        return self::$PDO;
    }
548292
protected function createPDO(): PDO
    {
        return new PDO(
            $this->options['connection'] ?? $this->options['dsn'],
            $this->options['username'],
            $this->options['password'],
            $this->options['options']
        );
    }
208662
public function getTableKeys($table)
	{
		$keys = array();

		$fieldCasing = $this->connection->getAttribute(\PDO::ATTR_CASE);

		$this->connection->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_UPPER);

		$table = strtoupper($table);

		$this->setQuery('pragma table_info( ' . $table . ')');
		$rows = $this->loadObjectList();

		foreach ($rows as $column)
		{
			if ($column->PK == 1)
			{
				$keys[$column->NAME] = $column;
			}
		}

		$this->connection->setAttribute(\PDO::ATTR_CASE, $fieldCasing);

		return $keys;
	}
95259
public function getPdoStatement(\PDO $pdo)
    {
        $stmt = $pdo->prepare($this->getSqlString());

        $bound = $this->getBoundValues();

        foreach ($bound as $name => $bind) {
            $stmt->bindValue($name, $bind[0], $bind[1]);
        }

        return $stmt;
    }
304847
protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = array())
    {
        if ($this->container->bound($key = "db.connection.{$driver}")) {
            return $this->container->make($key, array($connection, $database, $prefix, $config));
        }

        switch ($driver)
        {
            case 'mysql':
                return new MySqlConnection($connection, $database, $prefix, $config);

            case 'pgsql':
                return new PostgresConnection($connection, $database, $prefix, $config);

            case 'sqlite':
                return new SQLiteConnection($connection, $database, $prefix, $config);

            case 'sqlsrv':
                return new SqlServerConnection($connection, $database, $prefix, $config);
        }

        throw new \InvalidArgumentException("Unsupported driver [$driver]");
    }
627683
public function initDB(\PDO $db)
    {
        $db->exec('drop table if exists "caching"');
        $db->exec('CREATE TABLE "caching" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "keyword" VARCHAR UNIQUE, "object" BLOB, "exp" INTEGER)');
        $db->exec('CREATE UNIQUE INDEX "cleanup" ON "caching" ("keyword","exp")');
        $db->exec('CREATE INDEX "exp" ON "caching" ("exp")');
        $db->exec('CREATE UNIQUE INDEX "keyword" ON "caching" ("keyword")');
    }
1208412
private function createCache(array $cache)
    {
        ksort($cache);

        $format = "\t%s => %s," . PHP_EOL;
        $rows = [];

        foreach ($cache as $key => $value) {
            $rows[] = sprintf($format, var_export($key, true), var_export($value, true));
        }

        return sprintf('<?php return [%s];' . PHP_EOL, PHP_EOL . implode('', $rows));
    }