How to configure beanstalkd to work with laravel Cache?

117 Views Asked by At

I am trying to do some Cache operation inside an Event class which is a job processed by beanstalkd.

class NotificationListener implements ShouldQueue {
    public function __construct() {}

    public function handle() {
      //Handle notification stuff
    }

}

Then inside the handle function I am trying to store something in the laravel Cache:

  Cache::put("id", "123");

Unfortunately this throws following error:

file_put_contents(server_path/storage/framework/cache/data/18/60/18604da75750f7c9cd8eaf1a60b2210f8e4d4367): failed to open stream: No such file or directory at server_path/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:133)

I am using file driver for the Cache:

From Config.php:

'file' => [
            'driver' => 'file',
            'path' => storage_path('framework/cache/data'),
        ],

I believe the issue is that beanstalkd is using trying to access Cache from a different path than laravel does. However, I am not sure how to configure that behavior. The cache is working fine when used inside Controller and any other place that is not run by beanstalkd.

Laravel version: "laravel/framework": "7.12.*"

Appreciate any help.

0

There are 0 best solutions below