GithubHelp home page GithubHelp logo

Allow overriding the hardcoded retry timeout of 15 in php.ini for connect, as well as for connect/memcache_pconnect calls? about pecl-memcache HOT 5 CLOSED

TysonAndre avatar TysonAndre commented on June 15, 2024 1
Allow overriding the hardcoded retry timeout of 15 in php.ini for connect, as well as for connect/memcache_pconnect calls?

from pecl-memcache.

Comments (5)

Zaffy avatar Zaffy commented on June 15, 2024

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.

TysonAndre avatar TysonAndre commented on June 15, 2024

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.

Zaffy avatar Zaffy commented on June 15, 2024

Ah, ok. That should be easy to implement. I'll look into it.

from pecl-memcache.

Zaffy avatar Zaffy commented on June 15, 2024

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.

TysonAndre avatar TysonAndre commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.