mysqlnd_memcache_get_config
(PECL mysqlnd_memcache >= 1.0.0)
mysqlnd_memcache_get_config — Returns information about the plugin configuration
说明
mysqlnd_memcache_get_config ( mixed$connection
) : array
This function returns an array of all mysqlnd_memcache related configuration information that is attached to the MySQL connection. This includes MySQL, the Memcache object provided via mysqlnd_memcache_set(), and the table mapping configuration that was automatically collected from the MySQL Server.
参数
connection
A handle to a MySQL Server using one of the MySQL API extensions for PHP, which are PDO_MYSQL, mysqli or ext/mysql.
返回值
An array of mysqlnd_memcache configuration information on success, otherwise FALSE
.
The returned array has these elements:
Note:
The separator, which can be set in the MySQL Server configuration, should not be part of any value retrieved via memcache because proper mapping can't be guaranteed.
范例
Example #1 mysqlnd_memcache_get_config() example
<?php
$mysqli = new mysqli("host", "user", "passwd", "database");
$memc = new Memcached();
$memc->addServer("host", 11211);
mysqlnd_memcache_set($mysqli, $memc);
var_dump(mysqlnd_memcache_get_config($mysqli));
?>
以上例程会输出:
array(4) { ["memcached"]=> object(Memcached)#2 (0) { } ["pattern"]=> string(125) "/^\s*SELECT\s*(.+?)\s*FROM\s*`?([a-z0-9_]+)`?\s*WHERE\s*`?([a-z0-9_]+)`?\s*=\s*(?(?=["'])["']([^"']*)["']|([0-9e\.]*))\s*$/is" ["mappings"]=> array(1) { ["mymem_test"]=> array(6) { ["prefix"]=> string(13) "@@mymem_test." ["schema_name"]=> string(4) "test" ["table_name"]=> string(10) "mymem_test" ["id_field_name"]=> string(2) "id" ["separator"]=> string(1) "|" ["fields"]=> array(3) { [0]=> string(2) "f1" [1]=> string(2) "f2" [2]=> string(2) "f3" } } } ["mapping_query"]=> string(209) " SELECT c.name, CONCAT('@@', c.name, (SELECT value FROM innodb_memcache.config_options WHERE name = 'table_map_delimiter')) AS key_prefix, c.db_schema, c.db_table, c.key_columns, c.value_columns, (SELECT value FROM innodb_memcache.config_options WHERE name = 'separator') AS sep FROM innodb_memcache.containers c" }
参见
mysqlnd_memcache_set() - Associate a MySQL connection with a Memcache connection
User Contributed Notes
There are no user contributed notes for this page.官方地址:https://www.php.net/manual/en/function.mysqlnd-memcache-get-config.php