Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
df52510f
Commit
df52510f
authored
Jan 27, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed potential problem about using unset variables.
CS fix.
parent
505cb7d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
Cache.php
framework/caching/Cache.php
+13
-15
No files found.
framework/caching/Cache.php
View file @
df52510f
...
...
@@ -173,7 +173,7 @@ abstract class Cache extends Component implements \ArrayAccess
$results
[
$key
]
=
$values
[
$newKey
];
}
else
{
$value
=
$this
->
serializer
===
null
?
unserialize
(
$values
[
$newKey
])
:
call_user_func
(
$this
->
serializer
[
1
],
$values
[
$newKey
]);
:
call_user_func
(
$this
->
serializer
[
1
],
$values
[
$newKey
]);
if
(
is_array
(
$value
)
&&
!
(
$value
[
1
]
instanceof
Dependency
&&
$value
[
1
]
->
getHasChanged
(
$this
)))
{
$results
[
$key
]
=
$value
[
0
];
...
...
@@ -232,14 +232,14 @@ abstract class Cache extends Component implements \ArrayAccess
$data
=
[];
foreach
(
$items
as
$key
=>
$value
)
{
$itemKey
=
$this
->
buildKey
(
$key
);
if
(
$this
->
serializer
===
null
)
{
$
itemV
alue
=
serialize
([
$value
,
$dependency
]);
$
v
alue
=
serialize
([
$value
,
$dependency
]);
}
elseif
(
$this
->
serializer
!==
false
)
{
$
itemV
alue
=
call_user_func
(
$this
->
serializer
[
0
],
[
$value
,
$dependency
]);
$
v
alue
=
call_user_func
(
$this
->
serializer
[
0
],
[
$value
,
$dependency
]);
}
$data
[
$itemKey
]
=
$itemValue
;
$key
=
$this
->
buildKey
(
$key
);
$data
[
$key
]
=
$value
;
}
return
$this
->
setValues
(
$data
,
$expire
);
}
...
...
@@ -263,14 +263,14 @@ abstract class Cache extends Component implements \ArrayAccess
$data
=
[];
foreach
(
$items
as
$key
=>
$value
)
{
$itemKey
=
$this
->
buildKey
(
$key
);
if
(
$this
->
serializer
===
null
)
{
$
itemV
alue
=
serialize
([
$value
,
$dependency
]);
$
v
alue
=
serialize
([
$value
,
$dependency
]);
}
elseif
(
$this
->
serializer
!==
false
)
{
$
itemV
alue
=
call_user_func
(
$this
->
serializer
[
0
],
[
$value
,
$dependency
]);
$
v
alue
=
call_user_func
(
$this
->
serializer
[
0
],
[
$value
,
$dependency
]);
}
$data
[
$itemKey
]
=
$itemValue
;
$key
=
$this
->
buildKey
(
$key
);
$data
[
$key
]
=
$value
;
}
return
$this
->
addValues
(
$data
,
$expire
);
}
...
...
@@ -389,7 +389,7 @@ abstract class Cache extends Component implements \ArrayAccess
/**
* Stores multiple key-value pairs in cache.
* The default implementation calls [[setValue()]] multiple times store values one by one. If the underlying cache
* storage supports multiset, this method should be overridden to exploit that feature.
* storage supports multi
-
set, this method should be overridden to exploit that feature.
* @param array $data array where key corresponds to cache key while value is the value stored
* @param integer $expire the number of seconds in which the cached values will expire. 0 means never expire.
* @return array array of failed keys
...
...
@@ -397,8 +397,7 @@ abstract class Cache extends Component implements \ArrayAccess
protected
function
setValues
(
$data
,
$expire
)
{
$failedKeys
=
[];
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
if
(
$this
->
setValue
(
$key
,
$value
,
$expire
)
===
false
)
{
$failedKeys
[]
=
$key
;
}
...
...
@@ -409,7 +408,7 @@ abstract class Cache extends Component implements \ArrayAccess
/**
* Adds multiple key-value pairs to cache.
* The default implementation calls [[addValue()]] multiple times add values one by one. If the underlying cache
* storage supports multiadd, this method should be overridden to exploit that feature.
* storage supports multi
-
add, this method should be overridden to exploit that feature.
* @param array $data array where key corresponds to cache key while value is the value stored
* @param integer $expire the number of seconds in which the cached values will expire. 0 means never expire.
* @return array array of failed keys
...
...
@@ -417,8 +416,7 @@ abstract class Cache extends Component implements \ArrayAccess
protected
function
addValues
(
$data
,
$expire
)
{
$failedKeys
=
[];
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
if
(
$this
->
addValue
(
$key
,
$value
,
$expire
)
===
false
)
{
$failedKeys
[]
=
$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