Download the PHP package nodes/cache without Composer
On this page you can find all versions of the php package nodes/cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cache
Cache
An easy integration for handling caching - in a structured way - for Laravel.
Cache keys often build up and ends up being 3+ params attenpended in a string. Or caching on urls will make different order of query params have different version of same cache. Query params are often handled as hashmaps or dictionaries, which does not have a locked order
The worst part is, you end up with having cache settings shattered all over your project.
This package will make your life much easier
📝 Introduction
One thing we at Nodes have been missing a lot in Laravel is more structure of managing caches.
We've come up with a more flexible and structured way of managing caches and their lifetime. Also we've created a few helper methods to make it all a bit easier and awesome.
📦 Installation
To install this package you will need:
- Laravel 5.1+
- PHP 5.5.9+
You must then modify your composer.json
file and run composer update
to include the latest version of the package in your project.
Or you can run the composer require command from your terminal.
🔧 Setup
Setup service provider in config/app.php
Setup alias in config/app.php
Publish config file
If you want to overwrite any existing config files use the --force
parameter
⚙ Usage
Global methods
Facade methods
Examples
First important thing is to create the config for you new cache group, config should be in /config/nodes/cache.php (else you forgot to vendor:publish)
Will give you a $cacheGroup geographic.continent.bySlug
Remember to make the key unique to avoid conflicts
Remember
Remember is a way to both get and put to cache, 95% of cases this will be the right choice
This way we start by looking in cache, if data if found it will be returned. Else the closure will run where we look up the data in db and return. Returning it in closure will then cache it and return it.
Put
Just put data in cache
$success
is a bool
Get
Just get data from cache
$continent
is the continent or null
🏆 Credits
This package is developed and maintained by the PHP team at Nodes
📄 License
This package is open-sourced software licensed under the MIT license