mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.25k stars 212 forks source link

Flush single database in multi-tenant application #287

Closed roelVerdonschot closed 4 years ago

roelVerdonschot commented 5 years ago

When manually flushing the cache all cache is invalidated. It would be useful to only flush the current database connection or have the option to pass a database name.

mikebronner commented 5 years ago

@roelVerdonschot thanks for the suggestion. That should be doable, I'll look into it.

mikebronner commented 5 years ago

I'm running into problems obtaining a list of all registered tags (needed to flush the cache selectively). Until this is resolved, this feature won't be able to be implemented.

mrcageman commented 4 years ago

When manually flushing the cache all cache is invalidated. It would be useful to only flush the current database connection or have the option to pass a database name.

We're also mighty interested in this feature.

roelVerdonschot commented 4 years ago

@mrcageman You can make a script to flush every model one-by-one it's not the most elegant solutions but it works for now.

mikebronner commented 4 years ago

Unfortunately clearing cache by database is currently not possible due to driver limitations. I was unable to find a method to list all existing tags for the redis and memcached drivers. If someone finds a way, please let me know, and I'll be happy to implement it.