Comments (3)
Actually it does throw an exception of type Predis\Network\ConnectionException
if you are using v0.7.0-dev while for v0.6.x it's Predis\CommunicationException
. The message of the thrown exception is indeed Connection refused
.
If you want you can even do an upfront check before sending any command like this (works for both v0.6 and v0.7):
// create a client instance
$client = new Predis\Client();
try {
// explicitly call Predis\Client::connect()
$client->connect();
}
catch (Predis\CommunicationException $exception) {
// do stuff to handle the fact that you weren't able to connect to the server
// here I'm using exit() just as a quick example...
exit("whoops, couldn't connect to the remote redis instance!");
}
// if everything went fine, then go ahead with your commands...
$client->info();
So am I just missing something?
from predis.
After reading your message I realized I had been misreading my own code - it's definitely throwing an exception. Thanks for taking the time to clarify this!
from predis.
I see, well if it works then that's fine :-)
from predis.
Related Issues (20)
- Cache optimization placeholder
- Integration testing with Redis standalone
- Integration testing with Redis OSS cluster API
- Integration testing with Redis Enterprise
- Provide a hook so that a user can delete something from the cache storage
- Get from local cache
- Determine internal format of the cache (i.e is it key of value/expiration pairs, or something else)
- Save in local cache (presumably with an expiration)
- Cache configuration objects (to support memory, number of keys, etc)
- [v3] cherry-pick opt out setinfo for v3 HOT 1
- Update CLIENT-SETINFO to support suffixes HOT 1
- Missing BITFIELD_RO support HOT 1
- psubscribe seems to swallow exit, exceptions, disconnect, quit calls HOT 4
- Add support for GEOSHAPE index fields and WITHIN and CONTAINS query operators
- Error while writing bytes to the server HOT 3
- Error on RPOP expects exactly 1 argument, 2 given HOT 2
- Explain `expireResoluton` for `SET` HOT 1
- Improve connection speed by running fewer commands
- Question: the `ClientInterface::eval` signature and PhpRedis HOT 1
- Connect to Sentinel with username: how to implement right ? HOT 3
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 predis.