Giter Club home page Giter Club logo

Comments (7)

vesper8 avatar vesper8 commented on July 29, 2024

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.

mikebronner avatar mikebronner commented on July 29, 2024

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.

mikebronner avatar mikebronner commented on July 29, 2024

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.

vesper8 avatar vesper8 commented on July 29, 2024

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.

mikebronner avatar mikebronner commented on July 29, 2024

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.

mikebronner avatar mikebronner commented on July 29, 2024

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.

mikebronner avatar mikebronner commented on July 29, 2024

@vesper8 closing this for now, please let me know if you continue to have this problem.

from laravel-model-caching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.