Support the ongoing development of Laravel.io →
posted 9 years ago
Cache

Hi,

I'm writing a custom cache driver for DynamoDB and need to be able to overwrite the Cache::pull() method. I cannot use the default method (written below) for this driver as it calls the get and forget methods sequentially when, for DynamoDB, they can be done in one single call to the database. I need this functionality since reads/writes are provisioned so anything that takes up more impacts application performance.

    public function pull($key, $default = null)
    {
        $value = $this->get($key, $default);
        $this->forget($key);
        return $value;
    }

I've written most of my driver and all the other methods (get, forget, etc) work as expected, but this one doesn't. For testing, I made the function always return an arbitrary value so I could determine if my function or the default was running. I tried renaming it to puall and did a Cache::puall and it worked as expected, but I can't figure out how to overwrite the default Cache::pull.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.