atyagi / elasticache-laravel

Elasticache Session and Cache Drivers for Laravel
MIT License
25 stars 10 forks source link

If there are no servers defined don't try and register elasticache #17

Open EspadaV8 opened 8 years ago

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling b43696a70082f3e86dbf7ab90ee379aca818a152 on EspadaV8:master into \ on atyagi:master**.

atyagi commented 8 years ago

Thanks for the PR! Would you mind giving more background as to why you would like it to return if there are no servers? My initial thought was to fail immediately if your app wanted to use elasticache but you did not define any servers.

EspadaV8 commented 8 years ago

We initially had the Elasticache service provider in out app.php but didn't have the memcached extension installed so things were 'working' fine, however, we did an update on our development environment and as part of that added in the extension, however, because there aren't any servers enabled there the site then started crashing.

As a workaround for now the service provider is now added in another service provider, but that isn't really ideally since now service providers aren't all defined in a single location.

atyagi commented 8 years ago

Got it. If I'm understanding correctly, you're using elasticache in prod but not necessarily in a dev/test type of environment, correct? It sounds like it'd make more sense to switch out the actual cache driver used between environments, which sounds like a different config file for each environment, or leveraging an environment variable to determine your driver.