移植了/congfig/cache.php ;
use Illuminate\Support\Facades\Cache ;
测试后提示:
RuntimeException: A facade root has not been set. in F:\webman\vendor\illuminate\support\Facades\Facade.php:258
Stack trace:
F:\webman\app\controller\Index.php(10): Illuminate\Support\Facades\Facade::__callStatic('add', Array)
F:\webman\vendor\workerman\webman-framework\src\App.php(146): app\controller\Index->index(Object(support\Request))
F:\webman\vendor\workerman\workerman\Connection\TcpConnection.php(637): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
F:\webman\vendor\workerman\workerman\Events\Select.php(293): Workerman\Connection\TcpConnection->baseRead(Resource id #196)
F:\webman\vendor\workerman\workerman\Worker.php(2430): Workerman\Events\Select->loop()
F:\webman\vendor\workerman\workerman\Worker.php(1417): Workerman\Worker->run()
F:\webman\vendor\workerman\workerman\Worker.php(1360): Workerman\Worker::forkWorkersForWindows()
F:\webman\vendor\workerman\workerman\Worker.php(542): Workerman\Worker::forkWorkers()
F:\webman\start.php(156): Workerman\Worker::runAll()
{main}
主要是想使用文件缓存,这个功能!
主要使用文件缓存的话,就比较简单,我只告诉你简单实现过程,具体实际需求自己修改代码
composer require illuminate/cache
composer require illuminate/filesystem
然后 config/bootstrap.php内加入一行
然后重启就可以了
非常非常感谢!
虽然原代码不影响使用,但还是更正一下吧
严谨一点,把上面16行的self::$_instance 改成 static::$_instance
如何改成 redis 或者其他 缓存呢? 请赐教
@7845:下面回复你了
@8001:非常感谢
@yzh52521
还是简单写的,请根据自己的具体业务需求修改,没有跟laravel一样封装多种缓存驱动,
我按你file改的
$config = config('redis');
$reidsStore =new RedisStore(new RedisManager('', 'phpredis', $config));
static::$_instance = new Repository($fileStore);
可用就行
@7845:您好 根据你这个 为什么redis写入不了呢
很好用