Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
7be04c17
Commit
7be04c17
authored
Jun 28, 2016
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Поправка кєширования
parent
04e441ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
24 deletions
+13
-24
Memcache.php
Cache/Memcache.php
+13
-24
No files found.
Cache/Memcache.php
View file @
7be04c17
<?php
namespace
X\Cache
;
class
Memcache
{
/**
* @var mixed
*/
protected
$compression
=
false
;
class
Memcache
{
/**
* @var mixed
*/
...
...
@@ -15,19 +11,16 @@ class Memcache
* @var mixed
*/
protected
$mcache
=
false
;
/**
* @param $prefix
* @param $host
* @param $port
* @param $compression
*/
public
function
__construct
(
$prefix
,
$host
=
"localhost"
,
$port
=
11211
,
$compression
=
false
)
{
if
(
class_exists
(
"\memcache"
))
{
$this
->
prefix
=
$prefix
;
$this
->
compression
=
$compression
;
$this
->
mcache
=
new
\memcache
();
public
function
__construct
(
$prefix
,
$host
=
"localhost"
,
$port
=
11211
)
{
if
(
class_exists
(
"\memcache"
))
{
$this
->
prefix
=
$prefix
;
$this
->
mcache
=
new
\memcache
();
$this
->
mcache
->
connect
(
$host
,
$port
)
||
$this
->
mcache
=
false
;
...
...
@@ -39,29 +32,25 @@ class Memcache
* @param $value
* @param $expire
*/
public
function
set
(
$key
,
$value
,
$expire
=
240
)
{
if
(
!
$this
->
mcache
)
{
public
function
set
(
$key
,
$value
,
$expire
=
240
)
{
if
(
!
$this
->
mcache
)
{
return
$this
->
mcache
;
}
$key
=
$this
->
prefix
.
$key
;
return
$this
->
mcache
->
set
(
md5
(
$key
),
$value
,
$this
->
compression
,
$expire
);
return
$this
->
mcache
->
set
(
md5
(
$key
),
$value
,
0
,
$expire
);
}
/**
* @param $key
*/
public
function
get
(
$key
)
{
if
(
!
$this
->
mcache
)
{
public
function
get
(
$key
)
{
if
(
!
$this
->
mcache
)
{
return
$this
->
mcache
;
}
$key
=
$this
->
prefix
.
$key
;
return
$this
->
mcache
->
get
(
md5
(
$key
),
$this
->
compression
);
return
$this
->
mcache
->
get
(
md5
(
$key
),
0
);
}
}
?>
\ 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