Skip to content

When cache invalidation happens ? #98

@gustavobgama

Description

@gustavobgama

Issue

My issue is really a clarification about how this library works. I created a fresh installation of laravel and added the model caching package.

I've created a simple model using the cachable trait:

class Order extends Model { use Cachable; } 

After, using the tinker and a factory I've created 10 orders and listed them using App\Order::all(). This returns to me the 10 orders from the cache. Nice !

After that I removed one of the orders with App\Order::destroy(10) and the result of App\Order::all() continued to be the 10 orders.

Is this the expected behavior ? Is there a way to invalidate cache not using the command php artisan modelCache:flush --model=\\App\\Order but in every database change ?

By the way, I'm used the sqlite for this test.

Thanks in advance !!

Environment

Laravel Version: 5.6.7
Laravel Model Caching Package Version: 0.2.47
PHP Version: 7.1.8
Operating System & Version: Ubuntu 17.10

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions