Comments (7)
Furthermore I just tested flushing a model and noticed you have to provide double slashes on the command line:
php artisan modelCache:flush --model=\MyVendor\MyModule\Models\MyModel
fails
but
php artisan modelCache:flush --model=\\MyVendor\\MyModule\\Models\\MyModel
works
from laravel-model-caching.
yes, the double-slashes is expected. :)
Regarding flushing only model caching when you don't provide a model, I don't see that being implemented at the moment, due to the complexity involved of figuring out which models are cached models, and then to iterate through them and flush each one individually.
If you can submit a PR to get this expedited, that would help. I'll definitely keep it on the radar for future consideration, though. Thanks! :)
from laravel-model-caching.
I added this now in version 0.2.33. To achieve this, I recommend setting up a dedicated cache connection for laravel-model-cache, then use the php artisan modelCache:flush
command. Let me know how that works.
from laravel-model-caching.
Thanks for implementing this @mikebronner but I have a few concerns about it
First of all shouldn't config('laravel-model-caching:store') be config('laravel-model-caching.store') ? Does config work with either : or . ? I never tried it with :
Also.. I see that you don't provide any default value in your configuration file, instead you just use env('MODEL_CACHE_STORE') which isn't an existing env variable. What is supposed to be this value? A connection name?
So what will happen if someone tries to run this and they haven't configured this variable? What would happen then?
Also.. you recommend setting a dedicated cache connection.. is that a requirement or a recommendation? What will happen if one doesn't do that.. will it flush more than just the part of the cache occupied by this package?
from laravel-model-caching.
Hmm, let me look at the cache store configuration name issue. That might have been slipping by me this whole time. Thanks for noticing.
If you don't set up a dedicated cache store, it would flush the entire cache. I was just thinking I should elaborate on this in the documentation.
from laravel-model-caching.
Hi @vesper8 , could you try again using release 0.2.34? I have gone through and done some refactoring and quite a bit of cleanup. Please let me know how that works for you. :)
I will be updating the readme tomorrow with more details on the updates to flush the cache, as well as some other changes in this release. Thanks for being patient. :)
from laravel-model-caching.
@vesper8 closing this for now, please let me know if you continue to have this problem.
from laravel-model-caching.
Related Issues (20)
- 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 25
- 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 HOT 1
- Uuid fromBytes throwing a error HOT 1
- Observer for Pivot Model not firing HOT 3
- Bug: CacheKey::getValuesFromBindings(): Return value must be of type string, null returned | when where value is null HOT 1
- Object of class Illuminate\Database\Query\Expression could not be converted to string
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.