๐๐ฒ๐! ๐ ๐ง๐ผ๐ฑ๐ฎ๐ ๐'๐บ ๐ฝ๐ผ๐๐๐ถ๐ป๐ด ๐บ๐ ๐ญ๐๐ ๐ฐ๐ผ๐ฑ๐ฒ ๐๐ถ๐ฝ ๐ณ๐ผ๐ฟ ๐๐ฎ๐ฟ๐ฎ๐๐ฒ๐น๐ถ๐ฎ๐ป๐ โค๏ธ
I hope that you'll enjoy it ๐ฅณ & don't forget to follow me for more tips & tricks in the future ๐
Look how easy it is to make file-based cache's in Laravel.
๐ญ. ๐ช๐ต๐ฎ๐ ๐ถ๐ ๐๐ฎ๐ฝ๐ฝ๐ฒ๐ป๐ถ๐ป๐ด?
๐๐ฎ๐ฐ๐ต๐ฒ::๐ฟ๐ฒ๐บ๐ฒ๐บ๐ฏ๐ฒ๐ฟ(): Method is used to store and retrieve data efficiently in hashtag#Laravel.
๐ฐ๐ฎ๐ฐ๐ต๐ฒ๐ก๐ฎ๐บ๐ฒ: If a cache with this key "cacheName" exists, the cached data is returned. If not, the callback function runs, fetches all users, stores it in the cache, and returns it.
๐ป๐ผ๐()->๐ฎ๐ฑ๐ฑ๐๐ฎ๐(): sets the cache expiration to 24 hours from the current time.
๐ฏ. ๐จ๐๐ฒ ๐๐ฎ๐๐ฒ
This approach helps optimize database queries by reducing repetitive calls, improving your App's speed & performance.
Back
โข
Hey! It is not necessarily a file-based cache. It all depends on your config, but in Laravel, cache might be DB-based, file-based and Redis/Memcached based
โข
Yeah! I know it necessarily a file-based case but as you know that "file-based" is built-in without any configuration & I'm talking about that.
Redis it the most recommended cache-based database.