-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cache driver config. #449
Conversation
Signed-off-by: dingdayu <[email protected]>
@dingdayu 需要再加一个配置类型检查,必须实现缓存接口的对象 |
Signed-off-by: dingdayu <[email protected]>
$this['cache'] = function () { | ||
return new FilesystemCache(sys_get_temp_dir()); | ||
}; | ||
if (empty($this['config']['cache'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Doctrine\Common\Cache as CacheInterface;
...
if (empty($this['config']['cache']) || !($this['config']['cache'] instanceof CacheInterface))
Signed-off-by: dingdayu <[email protected]>
检测 |
Signed-off-by: dingdayu <[email protected]>
@dingdayu 不好,万一用户不想用这个库的缓存想自定义怎么办?还是用接口检查,这是接口存在的意义 。 |
Signed-off-by: dingdayu <[email protected]>
Signed-off-by: dingdayu <[email protected]>
@@ -25,6 +25,7 @@ | |||
*/ | |||
namespace EasyWeChat\Foundation; | |||
|
|||
use Doctrine\Common\Cache as CacheInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不存在吧?正确的应该是:Doctrine\Common\Cache\Cache
as 不是别名定义吗? |
@dingdayu 前面写错了。。。,是 Cache\Cache,你少写了一层。。。 |
汗,,发现了。。 |
Signed-off-by: dingdayu <[email protected]>
$this['cache'] = function () { | ||
return new FilesystemCache(sys_get_temp_dir()); | ||
}; | ||
if (!empty($this['config']['cache']) && $this['config']['cache'] instanceof CacheInterface) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
逻辑错误
丢大了,改了判断,没换里面的逻辑。。。 |
Signed-off-by: dingdayu <[email protected]>
可实现在实例化
Application
的时候配置AccessToken缓存方式示例:
Signed-off-by: dingdayu [email protected]