Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
6b965d71
Commit
6b965d71
authored
9 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
add seperate config option for locking memcache backend
parent
72847dbc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/config.sample.php
+6
-0
6 additions, 0 deletions
config/config.sample.php
lib/private/memcache/factory.php
+22
-1
22 additions, 1 deletion
lib/private/memcache/factory.php
lib/private/server.php
+3
-2
3 additions, 2 deletions
lib/private/server.php
with
31 additions
and
3 deletions
config/config.sample.php
+
6
−
0
View file @
6b965d71
...
...
@@ -1039,6 +1039,12 @@ $CONFIG = array(
*/
'filelocking.enabled'
=>
false
,
/**
* Memory caching backend for file locking
* Because most memcache backends can clean values without warning using redis is recommended
*/
'memcache.locking'
=>
'\OC\Memcache\Redis'
,
/**
* This entry is just here to show a warning in case somebody copied the sample
* configuration. DO NOT ADD THIS SWITCH TO YOUR CONFIGURATION!
...
...
This diff is collapsed.
Click to expand it.
lib/private/memcache/factory.php
+
22
−
1
View file @
6b965d71
...
...
@@ -46,13 +46,19 @@ class Factory implements ICacheFactory {
*/
private
$distributedCacheClass
;
/**
* @var string $lockingCacheClass
*/
private
$lockingCacheClass
;
/**
* @param string $globalPrefix
* @param string|null $localCacheClass
* @param string|null $distributedCacheClass
* @param string|null $lockingCacheClass
*/
public
function
__construct
(
$globalPrefix
,
$localCacheClass
=
null
,
$distributedCacheClass
=
null
)
$localCacheClass
=
null
,
$distributedCacheClass
=
null
,
$lockingCacheClass
=
null
)
{
$this
->
globalPrefix
=
$globalPrefix
;
...
...
@@ -62,8 +68,23 @@ class Factory implements ICacheFactory {
if
(
!
(
$distributedCacheClass
&&
$distributedCacheClass
::
isAvailable
()))
{
$distributedCacheClass
=
$localCacheClass
;
}
if
(
!
(
$lockingCacheClass
&&
$lockingCacheClass
::
isAvailable
()))
{
// dont fallback since the fallback might not be suitable for storing lock
$lockingCacheClass
=
'\OC\Memcache\Null'
;
}
$this
->
localCacheClass
=
$localCacheClass
;
$this
->
distributedCacheClass
=
$distributedCacheClass
;
$this
->
lockingCacheClass
=
$lockingCacheClass
;
}
/**
* create a cache instance for storing locks
*
* @param string $prefix
* @return \OCP\IMemcache
*/
public
function
createLocking
(
$prefix
=
''
)
{
return
new
$this
->
lockingCacheClass
(
$this
->
globalPrefix
.
'/'
.
$prefix
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
lib/private/server.php
+
3
−
2
View file @
6b965d71
...
...
@@ -234,7 +234,8 @@ class Server extends SimpleContainer implements IServerContainer {
$prefix
=
md5
(
$instanceId
.
'-'
.
$version
.
'-'
.
$path
);
return
new
\OC\Memcache\Factory
(
$prefix
,
$config
->
getSystemValue
(
'memcache.local'
,
null
),
$config
->
getSystemValue
(
'memcache.distributed'
,
null
)
$config
->
getSystemValue
(
'memcache.distributed'
,
null
),
$config
->
getSystemValue
(
'memcache.locking'
,
null
)
);
}
...
...
@@ -426,7 +427,7 @@ class Server extends SimpleContainer implements IServerContainer {
if
(
$c
->
getConfig
()
->
getSystemValue
(
'filelocking.enabled'
,
false
)
or
(
defined
(
'PHPUNIT_RUN'
)
&&
PHPUNIT_RUN
))
{
/** @var \OC\Memcache\Factory $memcacheFactory */
$memcacheFactory
=
$c
->
getMemCacheFactory
();
$memcache
=
$memcacheFactory
->
create
Distributed
(
'lock'
);
$memcache
=
$memcacheFactory
->
create
Locking
(
'lock'
);
if
(
!
(
$memcache
instanceof
\OC\Memcache\Null
))
{
return
new
MemcacheLockingProvider
(
$memcache
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment