Coder Social home page Coder Social logo

Comments (3)

itsgoingd avatar itsgoingd commented on May 30, 2024

Hey, thanks for the heads up.

Note, the following is based only on reading the Laravel code, I haven't tested anything.

Looks like for pipelines, they pass the PhpRedis client instance itself to the closure, instead of the Laravel's Redis connection, which dispatches the command-executed events.

Redis::pipeline(function ($pipe) {
    // This is PhpRedis instance, so Laravel has no idea what commands I'm calling.
    $pipe->get('foo');
});

I think they could literally just replace the PhpRedis instance with Laravel's Redis connection and it should "just work", since it passes all calls to the same PhpRedis instance internally.

This means simply replacing $pipeline with $this on this line:
https://github.com/laravel/framework/blob/10.x/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L405

Redis::pipeline(function ($pipe) {
    // This is now the same as calling Redis::get, so Laravel dispatches command-executed events.
    $pipe->get('foo');
    // Or you can literally just do this, without any changes to Laravel code and it should do the same thing
    Redis::get('foo');
});

I don't feel like working on this PR myself, but if anyone else wants to, I'm down to help.

from clockwork.

cyppe avatar cyppe commented on May 30, 2024

That is amazing.

I can confirm that using Redis::get('foo'); inside the pipeline closure really works. And it still uses the pipeline method. I was afraid it would go back to sending them one by one, but it really works.

Then if someone wants to do a PR to Laravel it would be even better as it will fix any code. But as I am not comfortable enough to do it I will change to using Redis::get in my code for now.

from clockwork.

unseen703 avatar unseen703 commented on May 30, 2024

@itsgoingd I am familiar with Laravel, PHP and I want to contribute to this, can you help me in how to start with raising a PR.

from clockwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.