Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

Using memcached in laravel. Is it normal application behavior?

Few words about my environment:

  • laravel 8;
  • osx bug sur,
  • mamp, php7.4.2 (with igbinary.so, memcached.so)
  • memcached (have installed with brew install memached)

When I starts the memcached demon and use test route to set() and get() data from memcached everything works properly.

But when I manually stops the memcached deamon, i want to see connection error exception in my app! Telnet said that connection is refused, but blank laravel app is still working (get() returns null, but no exception has been thrown).

What am I doing wrong? I want to see my exception)) Can any one help me? As I expect the application behaviour should be throwing an exception. Sample:

Route::get('/', function () {
    $cache = IlluminateSupportFacadesCache::store('memcached');
    $cache->put('asd','asdasdasd asdas d ',3600); # this line returns false, but as I expects should throw an excpetion when memcached is down
    dump($cache->get('asd'));
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...