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
5439ab78
Commit
5439ab78
authored
May 19, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the default value of `Cache::keyPrefix` to be null.
parent
5c5fcd6e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
27 deletions
+8
-27
CHANGELOG.md
framework/CHANGELOG.md
+1
-1
UPGRADE.md
framework/UPGRADE.md
+4
-0
Cache.php
framework/caching/Cache.php
+3
-16
CacheTestCase.php
tests/unit/framework/caching/CacheTestCase.php
+0
-10
No files found.
framework/CHANGELOG.md
View file @
5439ab78
...
...
@@ -63,7 +63,7 @@ Yii Framework 2 Change Log
-
Chg:
`yii\grid\DataColumn::getDataCellValue()`
visibility is now
`public`
to allow accessing the value from a GridView directly (cebe)
-
Chg:
`yii\data\ActiveDataProvider::$query`
will not be modified directly with pagination and sorting anymore so it will be reuseable (cebe)
-
Chg: Removed
`yii\rest\ActiveController::$transactional`
property and connected functionality (samdark)
-
Chg: Changed the default value of the
`keyPrefix`
property of cache components to be null (qiangxue)
2.
0.0-beta April 13, 2014
-------------------------
...
...
framework/UPGRADE.md
View file @
5439ab78
...
...
@@ -29,3 +29,7 @@ Upgrade from Yii 2.0 Beta
`yii\filters\auth\HttpBearerAuth`
authentication method, the value of this parameter will be
`yii\filters\auth\HttpBearerAuth`
. This allows you to differentiate access tokens taken by
different authentication methods.
*
If you are sharing the same cache across different applications, you should configure
the
`keyPrefix`
property of the cache component to use some unique string.
Previously, this property was automatically assigned with a unique string.
framework/caching/Cache.php
View file @
5439ab78
...
...
@@ -7,7 +7,6 @@
namespace
yii\caching
;
use
Yii
;
use
yii\base\Component
;
use
yii\helpers\StringHelper
;
...
...
@@ -52,10 +51,9 @@ use yii\helpers\StringHelper;
abstract
class
Cache
extends
Component
implements
\ArrayAccess
{
/**
* @var string a string prefixed to every cache key so that it is unique. If not set,
* it will use a prefix generated from [[\yii\base\Application::id]]. You may set this property to be an empty string
* if you don't want to use key prefix. It is recommended that you explicitly set this property to some
* static value if the cached data needs to be shared among multiple applications.
* @var string a string prefixed to every cache key so that it is unique globally in the whole cache storage.
* It is recommended that you set a unique cache key prefix for each application if the same cache
* storage is being used by different applications.
*
* To ensure interoperability, only alphanumeric characters should be used.
*/
...
...
@@ -71,17 +69,6 @@ abstract class Cache extends Component implements \ArrayAccess
*/
public
$serializer
;
/**
* Initializes the application component.
* This method overrides the parent implementation by setting default cache key prefix.
*/
public
function
init
()
{
parent
::
init
();
if
(
$this
->
keyPrefix
===
null
)
{
$this
->
keyPrefix
=
substr
(
md5
(
Yii
::
$app
->
id
),
0
,
5
);
}
}
/**
* Builds a normalized cache key from a given key.
...
...
tests/unit/framework/caching/CacheTestCase.php
View file @
5439ab78
...
...
@@ -58,16 +58,6 @@ abstract class CacheTestCase extends TestCase
return
$cache
;
}
/**
* default value of cache prefix is application id
*/
public
function
testKeyPrefix
()
{
$cache
=
$this
->
getCacheInstance
();
$this
->
assertNotNull
(
\Yii
::
$app
->
id
);
$this
->
assertNotNull
(
$cache
->
keyPrefix
);
}
public
function
testSet
()
{
$cache
=
$this
->
getCacheInstance
();
...
...
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