using Cache's forever() function and passing it a parameter gives Serialization of 'Closure' is not allowed

Posted 2 years ago by nikocraft
        $image = Cache::forever('image-'.$hash, function() use($hash){
            return Image::where('hash', $hash)->first();
        });

Exception in FileStore.php line 102: Serialization of 'Closure' is not allowed

however remeber function does not produce an error

        $image = Cache::remember('image-'.$hash, 15, function() use($hash){
            return Image::where('hash', $hash)->first();
        });

What's a difference?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.