Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
31106a92
Commit
31106a92
authored
Apr 28, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support implicit sectioned caching using :: syntax.
parent
4d2ecdbf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
4 deletions
+69
-4
laravel/cache/drivers/memcached.php
+69
-4
No files found.
laravel/cache/drivers/memcached.php
View file @
31106a92
...
...
@@ -17,6 +17,20 @@ class Memcached extends Driver implements Sectionable {
protected
$key
;
/**
* Indicates that section caching is implicit based on keys.
*
* @var bool
*/
public
$implicit
=
true
;
/**
* The implicit section key delimiter.
*
* @var string
*/
public
$delimiter
=
'::'
;
/**
* Create a new Memcached cache driver instance.
*
* @param Memcached $memcache
...
...
@@ -47,7 +61,13 @@ class Memcached extends Driver implements Sectionable {
*/
protected
function
retrieve
(
$key
)
{
if
((
$cache
=
$this
->
memcache
->
get
(
$this
->
key
.
$key
))
!==
false
)
if
(
$this
->
sectionable
(
$key
))
{
list
(
$section
,
$key
)
=
$this
->
parse
(
$key
);
return
$this
->
get_from_section
(
$section
,
$key
);
}
elseif
((
$cache
=
$this
->
memcache
->
get
(
$this
->
key
.
$key
))
!==
false
)
{
return
$cache
;
}
...
...
@@ -81,7 +101,16 @@ class Memcached extends Driver implements Sectionable {
*/
public
function
put
(
$key
,
$value
,
$minutes
)
{
$this
->
memcache
->
set
(
$this
->
key
.
$key
,
$value
,
$minutes
*
60
);
if
(
$this
->
sectionable
(
$key
))
{
list
(
$section
,
$key
)
=
$this
->
parse
(
$key
);
return
$this
->
put_in_section
(
$section
,
$key
,
$value
,
$minutes
);
}
else
{
$this
->
memcache
->
set
(
$this
->
key
.
$key
,
$value
,
$minutes
*
60
);
}
}
/**
...
...
@@ -107,7 +136,16 @@ class Memcached extends Driver implements Sectionable {
*/
public
function
forever
(
$key
,
$value
)
{
return
$this
->
put
(
$key
,
$value
,
0
);
if
(
$this
->
sectionable
(
$key
))
{
list
(
$section
,
$key
)
=
$this
->
parse
(
$key
);
return
$this
->
forever_in_section
(
$section
,
$key
,
$value
);
}
else
{
return
$this
->
put
(
$key
,
$value
,
0
);
}
}
/**
...
...
@@ -160,7 +198,23 @@ class Memcached extends Driver implements Sectionable {
*/
public
function
forget
(
$key
)
{
$this
->
memcache
->
delete
(
$this
->
key
.
$key
);
if
(
$this
->
sectionable
(
$key
))
{
list
(
$section
,
$key
)
=
$this
->
parse
(
$key
);
if
(
$key
==
'*'
)
{
$this
->
forget_section
(
$section
);
}
else
{
$this
->
forget_in_section
(
$section
,
$key
);
}
}
else
{
$this
->
memcache
->
delete
(
$this
->
key
.
$key
);
}
}
/**
...
...
@@ -224,6 +278,17 @@ class Memcached extends Driver implements Sectionable {
}
/**
* Indicates if a key is sectionable.
*
* @param string $key
* @return bool
*/
protected
function
sectionable
(
$key
)
{
return
$this
->
implicit
and
$this
->
sectioned
(
$key
);
}
/**
* Determine if a key is sectioned.
*
* @param string $key
...
...
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