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
aaeb7bc3
Commit
aaeb7bc3
authored
Apr 28, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on sectionable caches.
parent
31106a92
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
44 deletions
+44
-44
laravel/cache/drivers/memcached.php
+1
-35
laravel/cache/drivers/memory.php
+1
-1
laravel/cache/drivers/sectionable.php
+42
-8
No files found.
laravel/cache/drivers/memcached.php
View file @
aaeb7bc3
<?php
namespace
Laravel\Cache\Drivers
;
<?php
namespace
Laravel\Cache\Drivers
;
class
Memcached
extends
Driver
implements
Sectionable
{
class
Memcached
extends
Sectionable
{
/**
/**
* The Memcache instance.
* The Memcache instance.
...
@@ -277,37 +277,4 @@ class Memcached extends Driver implements Sectionable {
...
@@ -277,37 +277,4 @@ class Memcached extends Driver implements Sectionable {
return
$section
.
'#'
.
$this
->
section_id
(
$section
)
.
'#'
.
$key
;
return
$section
.
'#'
.
$this
->
section_id
(
$section
)
.
'#'
.
$key
;
}
}
/**
* 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
* @return bool
*/
protected
function
sectioned
(
$key
)
{
return
str_contains
(
$key
,
'::'
);
}
/**
* Get the section and key from a sectioned key.
*
* @param string $key
* @return array
*/
protected
function
parse
(
$key
)
{
return
explode
(
'::'
,
$key
,
2
);
}
}
}
\ No newline at end of file
laravel/cache/drivers/memory.php
View file @
aaeb7bc3
<?php
namespace
Laravel\Cache\Drivers
;
<?php
namespace
Laravel\Cache\Drivers
;
class
Memory
extends
Driver
implements
Sectionable
{
class
Memory
extends
Sectionable
{
/**
/**
* The in-memory array of cached items.
* The in-memory array of cached items.
...
...
laravel/cache/drivers/sectionable.php
View file @
aaeb7bc3
<?php
namespace
Laravel\Cache\Drivers
;
<?php
namespace
Laravel\Cache\Drivers
;
interface
Sectionable
{
abstract
class
Sectionable
extends
Driver
{
/**
/**
* Retrieve a sectioned item from the cache driver.
* Retrieve a sectioned item from the cache driver.
...
@@ -10,7 +10,7 @@ interface Sectionable {
...
@@ -10,7 +10,7 @@ interface Sectionable {
* @param mixed $default
* @param mixed $default
* @return mixed
* @return mixed
*/
*/
public
function
get_from_section
(
$section
,
$key
,
$default
=
null
);
abstract
public
function
get_from_section
(
$section
,
$key
,
$default
=
null
);
/**
/**
* Write a sectioned item to the cache.
* Write a sectioned item to the cache.
...
@@ -21,7 +21,7 @@ interface Sectionable {
...
@@ -21,7 +21,7 @@ interface Sectionable {
* @param int $minutes
* @param int $minutes
* @return void
* @return void
*/
*/
public
function
put_in_section
(
$section
,
$key
,
$value
,
$minutes
);
abstract
public
function
put_in_section
(
$section
,
$key
,
$value
,
$minutes
);
/**
/**
* Write a sectioned item to the cache that lasts forever.
* Write a sectioned item to the cache that lasts forever.
...
@@ -31,7 +31,7 @@ interface Sectionable {
...
@@ -31,7 +31,7 @@ interface Sectionable {
* @param mixed $value
* @param mixed $value
* @return void
* @return void
*/
*/
public
function
forever_in_section
(
$section
,
$key
,
$value
);
abstract
public
function
forever_in_section
(
$section
,
$key
,
$value
);
/**
/**
* Get a sectioned item from the cache, or cache and return the default value.
* Get a sectioned item from the cache, or cache and return the default value.
...
@@ -42,7 +42,7 @@ interface Sectionable {
...
@@ -42,7 +42,7 @@ interface Sectionable {
* @param int $minutes
* @param int $minutes
* @return mixed
* @return mixed
*/
*/
public
function
remember_in_section
(
$section
,
$key
,
$default
,
$minutes
,
$function
=
'put'
);
abstract
public
function
remember_in_section
(
$section
,
$key
,
$default
,
$minutes
,
$function
=
'put'
);
/**
/**
* Get a sectioned item from the cache, or cache the default value forever.
* Get a sectioned item from the cache, or cache the default value forever.
...
@@ -52,7 +52,7 @@ interface Sectionable {
...
@@ -52,7 +52,7 @@ interface Sectionable {
* @param mixed $default
* @param mixed $default
* @return mixed
* @return mixed
*/
*/
public
function
sear_in_section
(
$section
,
$key
,
$default
);
abstract
public
function
sear_in_section
(
$section
,
$key
,
$default
);
/**
/**
* Delete a sectioned item from the cache.
* Delete a sectioned item from the cache.
...
@@ -61,7 +61,7 @@ interface Sectionable {
...
@@ -61,7 +61,7 @@ interface Sectionable {
* @param string $key
* @param string $key
* @return void
* @return void
*/
*/
public
function
forget_in_section
(
$section
,
$key
);
abstract
public
function
forget_in_section
(
$section
,
$key
);
/**
/**
* Delete an entire section from the cache.
* Delete an entire section from the cache.
...
@@ -69,6 +69,39 @@ interface Sectionable {
...
@@ -69,6 +69,39 @@ interface Sectionable {
* @param string $section
* @param string $section
* @return int|bool
* @return int|bool
*/
*/
public
function
forget_section
(
$section
);
abstract
public
function
forget_section
(
$section
);
/**
* 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
* @return bool
*/
protected
function
sectioned
(
$key
)
{
return
str_contains
(
$key
,
'::'
);
}
/**
* Get the section and key from a sectioned key.
*
* @param string $key
* @return array
*/
protected
function
parse
(
$key
)
{
return
explode
(
'::'
,
$key
,
2
);
}
}
}
\ 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