Download the PHP package kolirt/laravel-cacheable without Composer
On this page you can find all versions of the php package kolirt/laravel-cacheable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kolirt/laravel-cacheable
More information about kolirt/laravel-cacheable
Files in kolirt/laravel-cacheable
Package laravel-cacheable
Short Description Easily cache and control class methods without having to remember cache key names
License MIT
Homepage https://github.com/kolirt/laravel-cacheable
Informations about the package laravel-cacheable
Laravel Cacheable
Easily cache and control class methods without having to remember cache key names
Structure
- Getting started
- Requirements
- Installation
- Setup
- Console commands
- Methods
- cache
- clearCache
- updateCache
- refreshCache
- setCacheTime
- flushAllCache
- appendCacheTags
- FAQ
- License
- Other packages

Getting started
Easily cache and control class methods without having to remember cache key names
Requirements
- PHP >= 8.1
- Laravel >= 10
Installation
Setup
Publish config file
By default, Laravel has a problem with multitags, which leads to excessive duplication of data in the cache and unexpected behavior when clearing and reading the cache. You can read more about it here. To fix this issue, add the following code to the composer.json
and run composer dump-autoload
Use the Cacheable
trait in the target class
Console commands
cacheable:install
- Install cacheable packagecacheable:publish-config
- Publish the config file
Methods
cache
Using the cache
method, cache everything you need
clearCache
To clear the cache, use the clearCache
method
updateCache
To update the cache, use the updateCache
method
refreshCache
To refresh the cache, use the refreshCache
method
setCacheTime
To set the cache time, use the setCacheTime
method
flushAllCache
Clearing the all cache works on tags. You have to switch the class to taggable mode
Or you can add tags to the class by using the appendCacheTags
method without taggable mode
To flush all cache, use the flushAllCache
method
appendCacheTags
In addition to the basic tag that is added automatically in taggable mode, you can add additional tags that you need using the appendCacheTags
method
Then, through Cache facade, you can delete the cache for the tag you need
FAQ
Check closed issues to get answers for most asked questions
License
MIT
Other packages
Check out my other packages on my GitHub profile