Skip to content
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

Merged
merged 8 commits into from
Jul 5, 2016
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
namespace EasyWeChat\Foundation;

use Doctrine\Common\Cache as CacheInterface;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不存在吧?正确的应该是:Doctrine\Common\Cache\Cache

use Doctrine\Common\Cache\FilesystemCache;
use EasyWeChat\Core\AccessToken;
use EasyWeChat\Core\Http;
Expand Down Expand Up @@ -196,9 +197,13 @@ private function registerBase()
return Request::createFromGlobals();
};

$this['cache'] = function () {
return new FilesystemCache(sys_get_temp_dir());
};
if (!empty($this['config']['cache']) && $this['config']['cache'] instanceof CacheInterface) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 逻辑错误

$this['cache'] = function () {
return new FilesystemCache(sys_get_temp_dir());
};
} else {
$this['cache'] = $this['config']['cache'];
}

$this['access_token'] = function () {
return new AccessToken(
Expand Down