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
cd147bb3
Commit
cd147bb3
authored
11 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
Use APCIterator for Memcache\APC::clear()
parent
1df1b55b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/memcache/apc.php
+8
-19
8 additions, 19 deletions
lib/private/memcache/apc.php
lib/private/memcache/apcu.php
+0
-7
0 additions, 7 deletions
lib/private/memcache/apcu.php
with
8 additions
and
26 deletions
lib/private/memcache/apc.php
+
8
−
19
View file @
cd147bb3
...
...
@@ -9,15 +9,8 @@
namespace
OC\Memcache
;
class
APC
extends
Cache
{
/**
* entries in APC gets namespaced to prevent collisions between owncloud instances and users
*/
protected
function
getNameSpace
()
{
return
$this
->
prefix
;
}
public
function
get
(
$key
)
{
$result
=
apc_fetch
(
$this
->
get
Namespace
()
.
$key
,
$success
);
$result
=
apc_fetch
(
$this
->
get
Prefix
()
.
$key
,
$success
);
if
(
!
$success
)
{
return
null
;
}
...
...
@@ -25,26 +18,22 @@ class APC extends Cache {
}
public
function
set
(
$key
,
$value
,
$ttl
=
0
)
{
return
apc_store
(
$this
->
get
Namespace
()
.
$key
,
$value
,
$ttl
);
return
apc_store
(
$this
->
get
Prefix
()
.
$key
,
$value
,
$ttl
);
}
public
function
hasKey
(
$key
)
{
return
apc_exists
(
$this
->
get
Namespace
()
.
$key
);
return
apc_exists
(
$this
->
get
Prefix
()
.
$key
);
}
public
function
remove
(
$key
)
{
return
apc_delete
(
$this
->
get
Namespace
()
.
$key
);
return
apc_delete
(
$this
->
get
Prefix
()
.
$key
);
}
public
function
clear
(
$prefix
=
''
)
{
$ns
=
$this
->
getNamespace
()
.
$prefix
;
$cache
=
apc_cache_info
(
'user'
);
foreach
(
$cache
[
'cache_list'
]
as
$entry
)
{
if
(
strpos
(
$entry
[
'info'
],
$ns
)
===
0
)
{
apc_delete
(
$entry
[
'info'
]);
}
}
return
true
;
$ns
=
$this
->
getPrefix
()
.
$prefix
;
$ns
=
preg_quote
(
$ns
,
'/'
);
$iter
=
new
\APCIterator
(
'user'
,
'/^'
.
$ns
.
'/'
);
return
apc_delete
(
$iter
);
}
static
public
function
isAvailable
()
{
...
...
This diff is collapsed.
Click to expand it.
lib/private/memcache/apcu.php
+
0
−
7
View file @
cd147bb3
...
...
@@ -9,13 +9,6 @@
namespace
OC\Memcache
;
class
APCu
extends
APC
{
public
function
clear
(
$prefix
=
''
)
{
$ns
=
$this
->
getNamespace
()
.
$prefix
;
$ns
=
preg_quote
(
$ns
,
'/'
);
$iter
=
new
\APCIterator
(
'user'
,
'/^'
.
$ns
.
'/'
);
return
apc_delete
(
$iter
);
}
static
public
function
isAvailable
()
{
if
(
!
extension_loaded
(
'apcu'
))
{
return
false
;
...
...
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