PHP Microservices by Sanchez Carlos Perez & Vilarino Pablo Solar
Author:Sanchez, Carlos Perez & Vilarino, Pablo Solar [Sanchez, Carlos Perez]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2017-03-29T04:00:00+00:00
Tip
The key is defined by you, so a good practice is generating a key that you can remember in order to regenerate in the future. In our example, we defined the key using L (for location) and then the latitude and longitude. However, if you are going to save an ID, it should be included as part of the key.
Working with our cache layer is easy in Lumen.
To obtain elements from the cache, you can use "get". It allows two parameters--the first one is to specify the key you want (and is required), and the second one is the value to use if the key is not stored in cache (and obviously is optional):
$value = Cache::get('key', 'default');
A similar method to store data available is Cache::forever($cacheKey, $cacheValue); this call will store the $cacheValue identified by $cacheKey in our cache layer, forever, until you delete or update it.
If you don't specify the expiration time for your stored elements, it is important to know how to remove them. In Lumen, you can do it with Cache::forget($cacheKey); if you know the $cacheKey assigned to an element. In the case of needing to remove all the elements stored in the cache, we can do this with a simple Cache::flush();.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8300)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7781)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6852)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6587)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6457)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Kotlin in Action by Dmitry Jemerov(5066)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4317)
Functional Programming in JavaScript by Mantyla Dan(4038)
Solidity Programming Essentials by Ritesh Modi(4010)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3803)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3746)
The Ultimate iOS Interview Playbook by Avi Tsadok(3721)
