Comments (10)
@hendra1 this should now be fixed in 0.2.41. Thank you so much for reporting this! The insert and update methods hadn't been accounted for yet. Please let me know how this update works for you.
from laravel-model-caching.
@hendra1 thanks for reporting this. Could you test again using the latest version of this package: 0.2.40? Thanks!
from laravel-model-caching.
Yes I did.. and the result is still same.
from laravel-model-caching.
Thanks, I will try to replicate it.
from laravel-model-caching.
Hi @hendra1,
Regarding your question about having a way to invalidate in the controller: that is not planned. The package should invalidate.
I am unable to recreate the problem with the following test:
public function testModelCacheDoesInvalidateWhenNoCooldownPeriod()
{
$authors = (new Author)
->get();
factory(Author::class, 1)->create();
$authorsAfterCreate = (new Author)
->get();
$uncachedAuthors = (new UncachedAuthor)
->get();
$this->assertCount(10, $authors);
$this->assertCount(11, $authorsAfterCreate);
$this->assertCount(11, $uncachedAuthors);
}
The test passes. Could you provide the queries you are running, specifically the initial query, the insert query, and the third query that is not getting the updated values?
Thanks!
from laravel-model-caching.
I found an issue, it has to do with insert. (Sorry I didn't test that right away, mia culpa. :) ) This test exposes it:
public function testInsertInvalidatesCache()
{
$authors = (new Author)
->get();
$newAuthor = (new Author)
->insert([
'name' => 'Test Insert',
'email' => '[email protected]',
]);
$authorsAfterInsert = (new Author)
->get();
$uncachedAuthors = (new UncachedAuthor)
->get();
$this->assertCount(10, $authors);
$this->assertCount(11, $authorsAfterInsert);
$this->assertCount(11, $uncachedAuthors);
}
I will work on fixing this ASAP!
from laravel-model-caching.
Hi Mike
Thanks for the update.. now it's work :)
from laravel-model-caching.
Awesome! That's great to hear. :) please let me know if you run into any other issues .
from laravel-model-caching.
I'm using
DB::insert();
to insert hundreds of records (this provide faster insert than MODEL::insert, any chance I can invalidate the cache?
from laravel-model-caching.
Hi @mrahmadt, could you open a new issue for this? Thanks!
from laravel-model-caching.
Related Issues (20)
- Only flush cache when delete() returns a count
- Clear cache in a record of the model. HOT 2
- Saving not working with eloquent strict mode HOT 2
- What is cacheCooldownSecounds definition? HOT 1
- Add support for Laravel 10 HOT 2
- Object of class Illuminate\\Database\\Query\\Expression could not be converted to string HOT 6
- Since 0.12.4 I get error "GeneaLabs\LaravelModelCaching\CacheKey::processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|string, null given, called in ...\vendor\genealabs\laravel-model-caching\src\CacheKey.php on line 409" HOT 23
- Cannot access "parent" when current class scope has no parent HOT 1
- Laravel v10.3.0 breaks LaravelModelCaching HOT 2
- checkCooldownAndFlushAfterPersisting(): Argument #2 ($relationship) must be of type string, array given, called in /var/www/html/vendor/genealabs/laravel-model-caching/src/Traits/ModelCaching.php on line 83 HOT 8
- Is table join supported? HOT 7
- The attribute [column3] either does not exist or was not retrieved for model HOT 1
- Stale cached value returned where(...)->first() HOT 4
- Fix for GeneaLabs\LaravelModelCaching\CacheKey::processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|string, null given
- processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|Illuminate\Database\Query\Expression|string, null given HOT 2
- Conflict with Spatie Schemaless
- Laravel 11 upgrade blocked by laravel-pivot-events dependency HOT 1
- Missing import in CachedBuilder?
- Fix failing tests
- Uuid fromBytes throwing a error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-model-caching.