friendsofhyperf / cache
The cache component for Hyperf.
v3.0.6
2023-01-30 09:49 UTC
Requires
- hyperf/cache: ~3.0.0
- nesbot/carbon: ^2.0
- 3.x-dev
- v3.0.6
- v3.0.2
- v3.0.1
- v3.0.0
- v3.0.0-rc.30
- v3.0.0-rc.21
- v3.0.0-rc.16
- v3.0.0-rc.9
- v3.0.0-rc.8
- v3.0.0-rc.7
- v3.0.0-rc.4
- v3.0.0-rc.2
- v3.0.0-rc.1
- v3.0.0-beta35
- v3.0.0-beta34
- v3.0.0-beta33
- v3.0.0-beta32
- v3.0.0-beta31
- v3.0.0-beta30
- v3.0.0-beta29
- v3.0.0-beta28
- v3.0.0-beta27
- v3.0.0-beta26
- v3.0.0-beta25
- v3.0.0-beta24
- v3.0.0-beta23
- v3.0.0-beta22
- v3.0.0-beta21
- v3.0.0-beta20
- v3.0.0-beta19
- v3.0.0-beta18
- v3.0.0-beta17
- v3.0.0-beta16
- v3.0.0-beta15
- v3.0.0-beta14
- v3.0.0-beta13
- v3.0.0-beta12
- v3.0.0-beta11
- v3.0.0-beta10
- v3.0.0-beta9
- v3.0.0-beta8
- v3.0.0-beta7
- v3.0.0-beta6
- v3.0.0-beta5
- v3.0.0-beta4
- v3.0.0-beta3
- v3.0.0-beta2
- v3.0.0-beta1
- 2.x-dev / 2.0.x-dev
- v2.0.28
- v2.0.24
- v2.0.22
- v2.0.19
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-beta3
- v2.0.0-beta2
- v2.0.0-beta1
This package is auto-updated.
Last update: 2023-01-31 01:19:35 UTC
README
The cache component for Hyperf.
Installation
- Request
composer require friendsofhyperf/cache
Usage
- Inject
namespace App\Controller; use FriendsOfHyperf\Cache\CacheInterface; use Hyperf\Di\Annotation\Inject; class IndexController { #[Inject] private CacheInterface $cache; public function index() { return $this->cache->remember($key, $ttl=60, function() { // return sth }); } }
- Facade
use FriendsOfHyperf\Cache\Facade\Cache; Cache::remember($key, $ttl=60, function() { // return sth });
- Switch driver
use FriendsOfHyperf\Cache\Facade\Cache; use FriendsOfHyperf\Cache\CacheManager; Cache::driver('co')->remember($key, $ttl=60, function() { // return sth }); CacheManager::get('co')->remember($key, $ttl=60, function() { // return sth });
Methods
Likes Laravel-Cache