Skip to content

Am I missing something obvious? #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mbuk opened this issue Dec 14, 2017 · 6 comments
Closed

Am I missing something obvious? #37

mbuk opened this issue Dec 14, 2017 · 6 comments
Assignees
Labels

Comments

@mbuk
Copy link

mbuk commented Dec 14, 2017

Issue

I have a model BannedIp - it extends CachedModel
When I delete a record using
BannedIp::where('id', 1)->delete();
The cache is not updated

Using a redis for my cache

namespace App;

use GeneaLabs\LaravelModelCaching\CachedModel;

class BannedIp extends CachedModel
{

}

It appears as if

static::deleted(function () use ($instance) {
            $instance->flushCache();
        });

in CachedModel.php is never hit

I'm trying a fresh install of laravel with a single model now to see if it's something specific to my laravel env

Environment

Laravel Version: 5.5.5
Laravel Model Caching Package Version: 0.2.10
PHP Version: 7.1.10
Homestead Version: N/A
Operating System & Version: OSX High Sierra 10.13.1

@mikebronner mikebronner self-assigned this Dec 14, 2017
@mikebronner
Copy link
Owner

Thanks for reporting this!! I will work on this ASAP, should have an update to you within the next 24 hours.

@mbuk
Copy link
Author

mbuk commented Dec 14, 2017

Thanks @mikebronner let me know if I can help!

@mbuk
Copy link
Author

mbuk commented Dec 14, 2017

@mikebronner a bit more info it if helps. Testing on a fresh install. If I do this
App\Testing::first()->delete();
The cache is cleared and static::deleted in CachedModel is hit

I think this might be expected behaviour from eloquent: see laravel/framework#2536

@mikebronner
Copy link
Owner

Thanks :) Just released v0.2.11 that should fix this. Let me know how it works. Closing issue for now, please re-open if you find some weirdness. :)

@mbuk
Copy link
Author

mbuk commented Dec 14, 2017

Works like a charm - thanks @mikebronner 👍

@mikebronner
Copy link
Owner

Awesome! :) Thanks for reporting it, please submit any other oddities you find as well! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants