As far as I am aware, there is no built in timeout feature for memcache calls. You might be able to implement yourself however, by using the
async versions of the calls and waiting a given time limit before moving forward with a plan B. You could ignore the result if it returns after the given time frame.
If you would like to see this sort of timeout feature built in to the library, I'd recommend filing a feature request on the
Issue Tracker. Be provide to provide a use case to explain how this feature would be beneficial.
Regarding the memcache calls hanging, I do not believe this to be the intended behavior of the service. I have not been able to find any documentation supporting the possibility that the call may hang indefinitely. As such, I would also recommend filing an issue for this as well. When doing so, be sure to include the following:
- How often memcache calls are hanging
- Any Stackdriver Trace data that these hanging calls may reveal
- Whether you are using shared or dedicated memcache
- Approximate volume of memcache storage when such errors occur
- Are these hanging errors limited to periods of high traffic, low traffic or happens frequently during both?