info("test redis start"); $key = "test-redis"; Redis::set($key, $value); if (Redis::exists($key)) { $this->info("has key " . $key); } else { $this->error("no key " . $key); } $expire = Redis::expire($key, 10); $this->info("key expire " . $expire); $this->info('del key ' . Redis::del($key)); Redis::set($key, $value); $getValue = Redis::get($key); if ($getValue === $value) { $this->info("redis set ok "); } else { $this->error("redis set fail "); } Redis::hSet("test-redis-hash", 'hash', $value); if (Redis::hGet("test-redis-hash", 'hash') == $value) { $this->info("redis hash set ok "); } else { $this->error("redis hash set fail "); } $this->info("test cache start"); $this->info("testing cache put"); $key = 'cache-key'; Cache::put($key, $value, 1000); if (Cache::has($key)) { $this->info("cache::put() exist key={$key}"); if (Cache::get($key) == $value) { $this->info("cache::get() ok value={$value}"); } else { $this->error("cache::get() fail "); } } else { $this->error('no key cache-key'); } $key = 'cache-key-2'; $this->info("testing cache() function"); $this->info("cache() key={$key} value={$value}"); cache(["cache-key-2" => $value]); if (Cache::has($key)) { if (Cache::get($key) == $value) { $this->info("cache() get ok value={$value}"); } else { $this->error("cache::get() fail "); } } else { $this->error('no key cache-key-2'); } $key = 'cache-key-3'; $this->info("testing cache remember()"); $value = Cache::remember($key, 600, function () { return 'cache-value-3'; }); if (Cache::has($key)) { $this->info("{$key} exist value=" . Cache::get($key)); } else { $this->error("cache::remember() fail."); } } }