Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-rpc
Commits
b4946025
Commit
b4946025
authored
Mar 16, 2021
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加缓存工具类
parent
2e963430
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
Cacher.php
src/Tools/Cacher.php
+43
-0
No files found.
src/Tools/Cacher.php
0 → 100644
View file @
b4946025
<?php
namespace
Meibuyu\Micro\Tools
;
use
Psr\SimpleCache\CacheInterface
;
/**
* Class Cache
* @package Meibuyu\Micro\Tools
* @method static get($key, $default = null)
* @method static set($key, $value, $ttl = null)
* @method static delete($key)
* @method static clear()
* @method static getMultiple($keys, $default = null)
* @method static setMultiple($values, $ttl = null)
* @method static deleteMultiple($keys)
* @method static has($key)
*/
class
Cacher
{
/**
* @var CacheInterface
*/
protected
static
$driver
;
/**
* @return CacheInterface
*/
public
static
function
driver
()
{
if
(
!
self
::
$driver
)
{
self
::
$driver
=
container
(
CacheInterface
::
class
);
}
return
self
::
$driver
;
}
public
static
function
__callStatic
(
$name
,
$arguments
)
{
return
static
::
driver
()
->
{
$name
}(
...
$arguments
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment