Comments (5)
The docs are obsolete, but the API supports this and should work just fine. Just pass third parameter to connect/pconnect.
object memcache_connect(string host [, int port [, double timeout ] ])
object memcache_pconnect(string host [, int port [, double timeout ] ])
You can also see from the code snippet you posted that although timeout is initialized to MMC_DEFAULT_TIMEOUT
it gets overridden immediately by optional timeout parameter, if provided.
from pecl-memcache.
I'd assumed that the timeout
applied to the initial connection attempt. (The one in the snippet - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ld", &host, &host_len, &tcp_port, &timeout) == FAILURE) {
)
However, I'm looking for a way to the retry_timeout
, which is used when memcache reconnects if the initial connection breaks (e.g. idle for a long time and disconnected by the load balancer or server). When I looked at the code, the former didn't seem to affect the latter
So something more like memcache_pconnect($host, $port = default, $timeout = default, $retry_timeout = 15)
from pecl-memcache.
Ah, ok. That should be easy to implement. I'll look into it.
from pecl-memcache.
Perhaps these APIs would suffice you?
bool memcache_set_server_params( memcache, string host [, int port [, double timeout [, int retry_interval [, bool status [, callback failure_callback ] ] ] ] ])
bool Memcache::setServerParams( string host [, int port [, double timeout [, int retry_interval [, bool status [, callback failure_callback ] ] ] ] ])
from pecl-memcache.
I'd overlooked those, those may help. They weren't documented on php.net when I checked, so I didn't realize they were an option - https://www.php.net/manual-lookup.php?pattern=memcache_set_server_params&lang=en&scope=404quickref
PRs can be made to https://github.com/php/doc-en
EDIT: Never mind, it's already there: https://www.php.net/manual/en/memcache.setserverparams
from pecl-memcache.
Related Issues (20)
- Memory Leak with 4.0.5.3 (PHP 7.4)
- get() can return invalid values after a PHP OOM HOT 1
- Using repcached for session slows down php module loading with version 8.2. (PHP 8.2)
- Creation of dynamic property Memcache::$connection is deprecated (in PHP 8.2)
- DLL available to download HOT 1
- Provide a getResultCode() to check if the most recent memcache operation had an error?
- PHP 8 HOT 11
- php8 windows build HOT 4
- Session Redundancy with Failover doesn't work on PHP7 HOT 7
- Idea: Support alternate serializers such as igbinary, msgpack, etc for arrays/objects
- PECL install not receiving -D --with-zlib-dir=/path/ option
- Test 035 fails after update to PHP 8.1 HOT 1
- Why is 3.x beta?
- Tag 3.0.7
- 3.0.8 tests fail because connect.inc is missing
- Unable to compile on Freebsd / PHP 7.4
- v8.0 on php8.1 showing as 4.0.5.2 on phpinfo() HOT 2
- 4.0.5.3 and 8.0.1 missing on pecl HOT 3
- cpu high load with php8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pecl-memcache.