Laravel & Ecosystem (50 Qs)•Part 2: Eloquent ORM, Security & Queue Ecosystem (11 - 24)
What is Caching in Laravel and how do Cache Tags work?
junior LevelMost AskedCode ExampleSecurity & AuthSystem DesignData Structures
In Simple Words: Unified caching API supporting Redis, Memcached, DynamoDB, and file drivers:
- Cache Tags (
tags()): Allows grouping related cache entries:
php
// Tag and store:
Cache::tags(['people', 'artists'])->put('John', $john, $seconds);
Cache::tags(['people', 'authors'])->put('Anne', $anne, $seconds);
// Flush ALL cache entries tagged with 'people' in a single line!
Cache::tags('people')->flush();
- Supported in Redis and Memcached; not supported in file/database drivers.