v5:userguide:memcached
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:userguide:memcached [2017/04/18 10:26] – [Memcached Setup] add wikipedia link, formatting, minor rewording dregad | v5:userguide:memcached [2022/03/29 18:29] (current) – [Usage] compress also works with memcached now dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Memcached Setup ====== | ====== Memcached Setup ====== | ||
+ | ===== Description ===== | ||
+ | This section describes connecting to an already configured Memcache server. Information about installation and configuration of Memcached servers can be found [[https:// | ||
+ | |||
+ | ===== The Memcache Library ===== | ||
+ | There are 2 distinct PEAR modules for connecting to a [[wp> | ||
<WRAP tip> | <WRAP tip> | ||
- | There are 2 PEAR modules for connecting to a [[wp> | ||
* Windows support is only available for the // | * Windows support is only available for the // | ||
* // | * // | ||
Line 8: | Line 12: | ||
* If both libraries are available, // | * If both libraries are available, // | ||
</ | </ | ||
- | + | ===== Why can't I use the memcached library under Windows? | |
- | ===== Description | + | The memcached library is much more heavily featured, more modern |
- | This section describes connecting to an already configured Memcache server. Information about installation | + | |
- | ===== The Memcache Library ===== | + | |
Line 36: | Line 38: | ||
/* | /* | ||
* Use ' | * Use ' | ||
- | * Note; Compression is only supported using the memcache library. This | ||
- | | ||
*/ | */ | ||
$db-> | $db-> | ||
Line 53: | Line 53: | ||
</ | </ | ||
+ | ===== Adding Weighted Server Groups ===== | ||
+ | |||
+ | From ADOdb version 5.22, the **memcached** library supports the use of **// | ||
+ | |||
+ | If the feature is used, the total weighting of the server group must equal 100%. To achieve this, the configuration of the servers must be defined in a different way to the default. Each host is defined as an array: | ||
+ | |||
+ | <code php> | ||
+ | array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | </ | ||
+ | |||
+ | The host arrays are then combined together. In this example 86.91 serves 70% of requests and 86.92 serves 30% | ||
+ | <code php> | ||
+ | |||
+ | $hosts = array( | ||
+ | array(' | ||
+ | array(' | ||
+ | ); | ||
+ | |||
+ | $db = NewADOConnection($driver=' | ||
+ | |||
+ | /* | ||
+ | * Enable memcache | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Add the weighted servers in $memCacheHosts. All other parameters are ignored. | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Adding options to the memcached server ===== | ||
+ | From ADOdb version 5.22, [[https:// | ||
+ | |||
+ | <code php> | ||
+ | |||
+ | $hosts = array( | ||
+ | array(' | ||
+ | array(' | ||
+ | ); | ||
+ | |||
+ | $db = NewADOConnection($driver=' | ||
+ | |||
+ | /* | ||
+ | * Enable memcache | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Add the weighted servers in $memCacheHosts | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Set some options | ||
+ | */ | ||
+ | $db-> | ||
+ | </ | ||
+ | |||
===== Using Debug Mode ===== | ===== Using Debug Mode ===== | ||
+ | |||
The size of query results that can be cached by the memcached server is limited by server configuration. The default is quite small. If the query is too large, and [[v5: | The size of query results that can be cached by the memcached server is limited by server configuration. The default is quite small. If the query is too large, and [[v5: | ||
+ | < | ||
+ | 3849805e4e026b9e7c485999a24a95c6 cache failure: Item with such key doesn' | ||
+ | (this is a notice and not an error) | ||
+ | -----< | ||
- | 3849805e4e026b9e7c485999a24a95c6 cache failure: Item with such key doesn' | + | (mysqli): SELECT * FROM employees |
- | | + | |
- | -----< | + | |
- | (mysqli): SELECT * FROM employees | + | ------< |
- | -----< | + | Notice: MemcachePool:: |
- | | + | SERVER_ERROR object too large for cache |
- | SERVER_ERROR object too large for cache | + | (3) in C: |
- | (3) in C: | + | Failed to save data at the memcached server! |
- | Failed to save data at the memcached server! | + | |
- | | + | Cache write error |
- | | + | PHP Notice: |
- | SERVER_ERROR object too large for cache (3) | + | SERVER_ERROR object too large for cache (3) |
- | in C: | + | in C: |
+ | </ | ||
ADOdb currently has no mechanism for splitting large queries into smaller chunks. | ADOdb currently has no mechanism for splitting large queries into smaller chunks. |
v5/userguide/memcached.1492504019.txt.gz · Last modified: 2017/04/21 11:39 (external edit)