Created
October 22, 2013 00:52
-
-
Save karptonite/7093489 to your computer and use it in GitHub Desktop.
Use of Cache tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Intended use of Tags | |
//an ordered array of tag names | |
$tags = array( 'people', 'authors' ); | |
//to store | |
Cache::tags( $tags )->put('John', $john); | |
//to access | |
//note that you need the whole list of tags to access | |
Cache::tags( $tags )->get('John'); | |
//Flushing either tag will flush John's cache. | |
//to flush just the authors | |
Cache::tag( 'authors' )->flush(); | |
//to flush all the people | |
Cache::tag( 'people' )->flush(); | |
//to flush multiple tags | |
Cache::tags( $tags )->flush(); | |
//section remains an alias of tag, and works just like the old section | |
Cache::section('people')->put('John', $john); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment